DFB_NZ wrote:
[ ... ]
So....I wrote a small application that reads using char, fgetc etc in
a text file and writes it out to another text file. The japanese was
preserved in the outfile.
[ ... ]
So why would I use wstring and wchar_t when string and char work with
Japanese anyway?
It all depends on what you're doing with the text. Reading and writing
narrow characters will work fine as long as your program basically just
passes the text through without caring about how many of those narrow
characters go to compose on real Japanese character.
If, however, your program needs to deal with the characters as
characters and (for example) cares about the boundary between one
character and the next, then converting them to wide characters will
start to make a lot more sense. The Unicode encodings are mostly pretty
easy (UCS-4 is trivial, but even UTF-8 is still fairly simple) but
(just for one example) Shift-JIS is seriously ugly, to put it nicely --
if you have to deal with it, you'd strongly prefer to use some
pre-written code. Of course, UCS-4 is rare and Shift-JIS almost
unavoidable...
--
Later,
Jerry.
The univserse is a figment of its own imagination.