How to read a cyrillic text file?!

Started by
2 comments, last by izhbq412 16 years, 11 months ago
Hello everyone, It seems that the MS Visual Studio somehow automatically converts cyrillic (ISO-1251) strings so that they can be associated with the appropriate characters in the font. However, when I read a text file with cyrillic content and load the data into char-string, I get an exception from Visual C... Assertion failed: Program: "..." File: isctype.c Line: 56 Expression: (unsigned)(c+1) <= 256 Does somebody know how to handle this? I would be very thankful if someone helps a bit...
Advertisement
What does your loading function look like?

C++: A Dialog | C++0x Features: Part1 (lambdas, auto, static_assert) , Part 2 (rvalue references) , Part 3 (decltype) | Write Games | Fix Your Timestep!

The problem isn't the loading. Each non-ASCII char in the file looks somewhat strange, but is still 1 byte. So the conversion occurs at runtime. I recognized, that my program crashes, because the function isspace() falls into an endless loop, probably because of the parameter is cyrillic (strange, when I pass a char to isspace(), it should check whether the char is '\n', '\r' etc, and nothing else...). Anyway, I found an indirect solution - I convert the text after the parsing, so it is displayed correctly. Still does somebody know how to handle non-ASCII characters, i.e. with which function set?

Thanx :)
Can you show a small sample of the file and exactly how you get the error? Also, which version of Visual Studio are you using and what's the language for non-Unicode programs in your regional settings?
_______________The essence of balance is detachment. To embrace a cause, to grow fond or spiteful, is to lose one''s balance after which, no action can be trusted. Our burden is not for the dependent of spirit. - Mayar, Third Keeper

This topic is closed to new replies.

Advertisement