PDA

View Full Version : can't read from unicode file .



gbmtoday
19th February 2010, 17:21
hi everyone !

I searched a lot in net but I couldnt fine any solution for my issue .

i want to read some data from a file


ifstream in ("input.txt");

when encoding of input.txt is ANSI i don't have any problem , but when i change the encoding to Unicode or UTF-8 the complier give me a warning :

Invalid parameter passed to C runtime function.


and the program doesn't run and say :
http://imgur.com/uehC1.png

I have windows 7 home premium .

I dont have this problem in Ubunutu9.10

I need your help !!

thank every one.

squidge
19th February 2010, 17:53
Show your code

gbmtoday
19th February 2010, 18:44
i don't think source code cause the error .
i think the problem is just because of encoding of input.txt that i want to read from that.
because when the input.txt encoding is ANSI , program runs without any error
but when i change the encoding to Unicode , program doesn't run .

----

which part of the code ?

code directory : http://saeed.pdprobocup.com/gstats
download link : http://saeed.pdprobocup.com/gstats.zip

gbmtoday
20th February 2010, 14:53
hey no idea !!! :(

Lykurg
20th February 2010, 16:11
hey no idea !!! :(

Hey, no source code??? And maybe you should use QFile if you work with Qt and not the "old" c/c++ functions to access a file.

gbmtoday
21st February 2010, 13:29
Hey, no source code??? And maybe you should use QFile if you work with Qt and not the "old" c/c++ functions to access a file.

hey thanks , i used QFile and now I can read from a unicode file , but

i want to read ARABIC or PERSIAN from the input file but it doesnt work correctly ...

any idea ?

:(

Lykurg
21st February 2010, 14:36
any idea ? Yes, but if we would see how you use QFile (filename and linenumber on your server) our answers could be a bit more precise. If you what specific control while reading from a file use QTextStream where you have more options. (QTextStream::setCodec() and/or QTextStream::setLocale())