1

I have very simple question, but my 4 hours of searching for answer did not help me. I have a text file in which i wrote: šđč枊ĐČĆŽ

I do not know how to read this properly and output it in console. Please help me. I am using C++ Visual Studio 2010.

Thanks in advance.

Alexander Pogrebnyak
  • 44,836
  • 10
  • 105
  • 121
  • Does your console definitely *support* those characters? What encoding is the file in? – Jon Skeet Jul 29 '13 at 20:18
  • Can you post some of the code you've tried? – Dan Pichelman Jul 29 '13 at 20:18
  • @JonSkeet yes my console supports those characters. I have been working with them, but not from files. DanPichelman I currently do not have any code, I am pissed off and nervous... so I deleted everything that I got and started all over again with this question. –  Jul 29 '13 at 20:24
  • You are using a text file whose encoding we don't know. You are using a language whose standard largely ignores Unicode. You are using a way to display the text that stopped making sense 20 years ago. It is pretty unclear where you want to start tackling this problem. – Hans Passant Jul 29 '13 at 20:28
  • If this is ANSI then assuming you are on windows (visual-studio-2010 tag) you should use MultiByteToWideChar. – marcinj Jul 29 '13 at 20:33

1 Answers1

1

How has it been encoded? If it is UTF-16, use std::wifstream! If other encoding is needed.

If it is UTF-8: use codec.

Community
  • 1
  • 1
Naszta
  • 7,560
  • 2
  • 33
  • 49