Apr 24, 2011 at 5:28pm Apr 24, 2011 at 5:28pm UTC
how can I read arabic characters from file?
when i do that i get only one character ???
i think it uses only ASCII, so can anybody help me how to read Unicode??
Apr 24, 2011 at 6:35pm Apr 24, 2011 at 6:35pm UTC
I also have troubles with unicode in general so i might be wrong bigtime, try this code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#include <iostream>
#include <string>
#include <fstream>
#include <locale>
int main()
{
setlocale(LC_ALL, ".1256" );
std::string buffer;
std::ifstream in("arabic.txt" );
in >> buffer;
in.close();
std::cout << buffer << std::endl;
std::cout << "Press enter to exit..." ;
std::cin.get();
return 0;
}
note that it should read only first line for test.
Last edited on Apr 24, 2011 at 6:46pm Apr 24, 2011 at 6:46pm UTC