开发者

Reading text from file and converting it to UTF32

开发者 https://www.devze.com 2023-03-19 08:26 出处:网络
I\'m using CSFML 1.6 library (it\'s multimedia library based on OpenGL). And I live in Poland, here we have special characters like:

I'm using CSFML 1.6 library (it's multimedia library based on OpenGL). And I live in Poland, here we have special characters like:

ąęźćół

Now I have a text file which consists this characters and CSFML offer function to set U开发者_JAVA技巧nicodeText on displayed string, it's argument is array of ints.

How can I properly read characters from file and then pass them to this function?

Any help really appreciated.


Judging to sfml-dev, the library accepts either char string in ISO-8859-1, or wchar_t string in UTF16, or there's a possibility to provide a completely own charset.

I suppose, the simplest is to stick with UTF16. Save your text in UTF16, and use the "wstring family" functions (those beginning with 'w', like wcscmp()) to handle it.

0

精彩评论

暂无评论...
验证码 换一张
取 消