ustring
ustring copied to clipboard
Feature safity for non unicode strings
I would like to see the API more feature safe to other encodings/charsets.
- rename
[get|set][Default]Codepage
to[get|set][Default]Encoding
- remove the
U
fromUString
(or use a different name)
$german = new UString("T\xD4st", 'ISO-8859-15');
Thoughts?
It's Unicode underneath... it should stay UString :/
This is confusing, please clarify what you mean @marc-mabe ?
As I understand correctly this extension provides a string object currently usable for unicode strings. That's fine!
To provide this you have a string class that gets a scalar string and a unicode encoding on instantiation.
For me it already has all API-side requirements to support non unicode encodings, too.
Sure it's theory and it's currently not required to finish the goal but as PHP developer you have to deal with other encodings from time to time (non unicode, non ascii). In this case you have to use mbstring
/iconv
anyway and this nice extension class UString
can't be used only because it handles only unicode strings by definition.
I think it could be really helpful in the future to have a more generalized API to make it possible to implement handing of non unicode encodings without BC breaks.
I hope it is clear what I mean - Sorry for my poor English grammar.