c++ - Distinguishing between string formats -
having untyped pointer pointing buffer can hold either ansi or unicode string, how tell whether current string holds multibyte or not?
unless string contains information format (e.g. header or a byte order mark) there no foolproof way detect if string ansi or unicode. windows api includes function called istextunicode() guesses if string ansi or unicode, then run problem because you're forced guess.
why have untyped pointer string in first place? must know , how data representing information, either using typed pointer in first place or provide ansi/unicode flag or something. string of bytes meaningless unless know represents.
Comments
Post a Comment