digitalmars.D.announce - National charsets support
- Nikolay (16/16) Oct 28 2015 I am quite happy with UTF support in phobos, but support for
I am quite happy with UTF support in phobos, but support for national codepages is very limited in phobos. Also it is not conform with ranges. So I decide share my project for supporting national charsets: https://bitbucket.org/sibnick/national-encoding.git Sample code: import national.charsets, std.array; dstring s = "123Я"; auto cp1251 = Windows1251.encode(s).array; auto utf32 = Windows1251.decode(cp1251).array; ubyte[] cp866 = CHARSETS["cp866"].encode(s).array; utf32 = CHARSETS["cp866"].decode(cp866).array; Every codec accepts range of some chars and returns range of ubytes. Every decoder accepts range of ubytes and returns range of dchars. This library is not cover UTF codecs, and multibytes national code pages.
Oct 28 2015