Please read the blog post provided by olivthill before going any further with your development.
Normally, a program will be compiled for UNICODE or MBCS and all strings will be one or the other so there is no need to use a function like this.
IsTextUnicode() would typically be used when you have a BYTE buffer of unknown format that was generated outside of your program and you want to determine if it contains UNICODE text.
However, before you use this function I would strongly urge you (again, as olivthill did) to consider whether or not this function is really useful. Perhaps if you told us why you think you need it we could offer better advice.
hey, thanks from your advices, yeap I know that this function maybe return a wrong value & it's not a reliable function .
and as one of you said, in normally, strings in a program will be compiled for UNICODE standard (UTF-16) .
but, suppose a program like notepad .
when you write some text in it, you can save it as the standard you want .
maybe you want to save it as ASCII & then you want to open a text file .
a program like notepad should be check the String format of the file and a Function like IsTextUnicode() need in the program to recognize the String Format of the file my program also need a function to check the String format of a specific file .
do you know any other idea regardless of using IsTextUnicode() for this matter ?
is there any way for recognizing the String Format of a specific file when you want to Open a file in your program ?
anyone can help about this ?
Last edited by escap3; July 19th, 2008 at 02:33 PM.
So, the logic of your program might be:
1. check for presence of a byte order mark (BOM). If not present, then the file is ASCII
2. If BOM is present, then the file is Unicode. Check for its format, to determine exactly the the precise type of Unicode encoding