Jump to content
  • Advertisement
Sign in to follow this  
xpload

How to read a cyrillic text file?!

This topic is 4065 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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...

Share this post


Link to post
Share on other sites
Advertisement
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 :)

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!