Sign in to follow this  
xpload

How to read a cyrillic text file?!

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this