On Thursday 04 August 2005 17:00, Eljay Love-Jensen wrote: > Hi everyone (and especially Benjamin Kosnik if you are listening), > > I have a stupid C++ question. I've spun my wheels for days on this issue. > > I've been lost in a morass of std:: ... basic_istream, basic_ostream, > basic_istringstream, basic_ostringstream, locale, facet, and codecvt. I'm really a fool regarding Unicode/UTFx issues, however, some things I noted are below: > class Utf8Char > { > uint8_t m; > public: > explicit Utf8Char(char in) : m(in) { } > operator uint8_t () const { return m; } > }; a UTF-8 character may (sometimes) be even 16bit of size; think about german umlauts, they get escaped somehow, and then follows the code for them. > class Utf16Char > { > uint16_t m; > public: > explicit Utf8Char(char in) : m(in) { } > operator uint16_t () const { return m; } > }; This really can't work either. Did you get this compile? You obviousely copy'n'paste-ed your 16/32-Char classes from the Utf8Char class and didn't change the constructor (btw). Sorry for not being much help more, but you could/shoult google for "encoding" and have a look around for some other implementations / how they're doing it (the en[/de]coding-way). Regards, Christian Parpart. -- 22:43:33 up 136 days, 11:51, 0 users, load average: 11.18, 8.93, 6.38
Attachment:
pgpy94rHRqHn0.pgp
Description: PGP signature