Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How to read and output text from a cp1251 file  (Read 1159 times)

0 Members and 1 Guest are viewing this topic.

Bibop

  • Newbie
  • *
  • Posts: 1
    • View Profile
How to read and output text from a cp1251 file
« on: September 09, 2019, 05:50:56 pm »
Hello. I try to read character by character the file in the cp1251 encoding and to output by means of sf:: Text, but instead of symbols garbage. What to do?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: How to read and output text from a cp1251 file
« Reply #1 on: September 09, 2019, 10:36:29 pm »
Can you post the code within the [code=cpp][/code] tag? Don't really want to download a random archive if I don't have to. ;)
Encoding is a tricky thing, especially in C++. You'll need to make sure you read the text correctly and then convert it correctly to SFML's UTF32 string, which sf::Text uses. But I have no idea how to convert cp1251 to UTF32. :-\
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything