1

Topic: Send unicode character in chat

hello
i have problem with sending unicode characters in both sides client and server
i got ? mark instead the real character!

for example
GameServer()->SendChatTarget(m_pPlayer->GetCID(),"Test \u014C");

with \u i able to send just standard alphanumeric chars a-z A-Z 1-9 and some sign such az @#$%

i inserted the unicode character in the cpp file but i got same result!!!

2

Re: Send unicode character in chat

Maybe your keyboard setting is in the wrong language?
That's all I got. neutral

nya~ :3c
r.i.p. Teeworlds

3 (edited by unsigned char* 2014-11-05 19:53:38)

Re: Send unicode character in chat

I test with..

GameServer()->SendChatTarget(-1, "B. Mírañ $%&/!! ^# -- \u014C");

and works.

My .cpp file have a UTF-8 codification

4

Re: Send unicode character in chat

unsigned char* wrote:

I test with..

GameServer()->SendChatTarget(-1, "B. Mírañ $%&/!! ^# -- \u014C");

and works.

My .cpp file have a UTF-8 codification

i changed the page encoding to UTF-8 but i saw the \u014C as a ? sign again!!
u saw the \u014C in correct format?!!
which os u use?? linux or win??

5

Re: Send unicode character in chat

Try octal code: "Test \305\214".

6 (edited by 2014-11-05 22:58:49)

Re: Send unicode character in chat

lamefun wrote:

Try octal code: "Test \305\214".

tnx it works but how can i convert hex to octal?
i used some online convertors but converted character wasnt equal to hex char !!

i tested the \uxxxx on linux and it works properly but not in windows!!
any body know how can i fix this problem on windows os??

7 (edited by lamefun 2014-11-06 09:57:54)

Re: Send unicode character in chat

If your compiler supports the 2011 C++ standard, you can also try: u8"Test ΣΩ \u014C". With normal "" strings, the compiler can use any encoding it chooses, but with u8 prefix of the 2011 C++ standard it's guaranteed to use UTF-8.

P.S. If that doesn't work, here's a text to octal converter: http://www.unit-conversion.info/texttools/octal/. Just write out all the numbers you get like this, without spaces: "ΣΩ" (original) -> 316 243 342 204 246 (converter output) -> "\316\243\342\204\246" (C++ string). Or use Linux character map: http://i.solidfiles.net/b64e379dfe.png

8

Re: Send unicode character in chat

TinToWw wrote:
unsigned char* wrote:

I test with..

GameServer()->SendChatTarget(-1, "B. Mírañ $%&/!! ^# -- \u014C");

and works.

My .cpp file have a UTF-8 codification

i changed the page encoding to UTF-8 but i saw the \u014C as a ? sign again!!
u saw the \u014C in correct format?!!
which os u use?? linux or win??

I use windows 7 but compiled with gcc not VC

9

Re: Send unicode character in chat

unsigned char* wrote:
TinToWw wrote:
unsigned char* wrote:

I test with..

GameServer()->SendChatTarget(-1, "B. Mírañ $%&/!! ^# -- \u014C");

and works.

My .cpp file have a UTF-8 codification

i changed the page encoding to UTF-8 but i saw the \u014C as a ? sign again!!
u saw the \u014C in correct format?!!
which os u use?? linux or win??

I use windows 7 but compiled with gcc not VC

is there any tutorials for compiling teeworlds with gcc ?

10 (edited by unsigned char* 2014-11-07 19:49:19)

Re: Send unicode character in chat

babak2010, don't need nothing special... install MinGW (http://sourceforge.net/projects/mingw/files/) and use bam without init visual envirionment (@%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86)

I made a video to explain how to setup code::blocks: https://www.youtube.com/watch?v=MSgGHUKnTZM

11

Re: Send unicode character in chat

unsigned char* wrote:

babak2010, don't need nothing special... install MinGW (http://sourceforge.net/projects/mingw/files/) and use bam without init visual envirionment (@%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86)

I made a video to explain how to setup code::blocks: https://www.youtube.com/watch?v=MSgGHUKnTZM

awesome thank you