SFML community forums

Help => Graphics => Topic started by: Robert on January 13, 2014, 08:55:25 pm

Title: non-ASCII characters
Post by: Robert on January 13, 2014, 08:55:25 pm
Hi, I want to display text containing "non-ASCII characters," but I have a little problem. As a parameter for the "setString ()" gives an element of an array of strings, but that the text handle "non-ASCII characters" before the string need to write "L", but how am I supposed to do in this case when I have quoted before, which should be put the "L"? Please help me, Excuse me for grammar, etc.
Title: Re: non-ASCII characters
Post by: Nexus on January 13, 2014, 09:03:39 pm
but how am I supposed to do in this case when I have quoted before, which should be put the "L"?
I don't really understand what you mean. Could you make a short code example?

sf::String is compatible to all kinds of strings: const char*, const wchar_t*, std::string, std::wstring
Title: Re: non-ASCII characters
Post by: Robert on January 13, 2014, 09:13:52 pm
text.setString(L"éèàç");
- in the guide.

In my case it looks like this:
text1.setString(mtexts[2]);

I do not know how in this case, I  can put the "L". : (
Title: Re: non-ASCII characters
Post by: Nexus on January 13, 2014, 09:47:03 pm
If you provide all the code, we won't have to guess. What type does mtexts[2] have?

I don't see why you need a "L", since sf::String already performs a conversion.
Title: Re: non-ASCII characters
Post by: Daddi on January 14, 2014, 07:57:50 pm
The L is only meant for string literals, not for variables :)
If you read you text from an utf encoded file, there shouldn't be a problem.