on the Turkish characters and the other non-ascii chracters
Moderator: Forum Moderators
on the Turkish characters and the other non-ascii chracters
In chat of the multiplayer game, we cannot write the Turkish characters
ğ Ğ ı İ
I've looked over the source code and make some compilaiton and here the resuls.
at first I checked that whether the textbox can display them or not;
result is they can display.
then, I looked at what happen the key strokes, and I saw that the characters get value 0, in the funciton
textbox::handle_event(const SDL_Event& event) {
in the line
wchar_t character = key.unicode;
where as key.sym method gets a correct value, at least distint.
I've tried
wchar_t character= 'Ş';
but this was showed only box not the character and also I get a compilation warning too. That is;
warning: multi-character character constant
at this point I'm stuck and need some help.
İhsan.
ğ Ğ ı İ
I've looked over the source code and make some compilaiton and here the resuls.
at first I checked that whether the textbox can display them or not;
result is they can display.
then, I looked at what happen the key strokes, and I saw that the characters get value 0, in the funciton
textbox::handle_event(const SDL_Event& event) {
in the line
wchar_t character = key.unicode;
where as key.sym method gets a correct value, at least distint.
I've tried
wchar_t character= 'Ş';
but this was showed only box not the character and also I get a compilation warning too. That is;
warning: multi-character character constant
at this point I'm stuck and need some help.
İhsan.
Westnoth is ruled by anNOYing King of Dragons
Ihsan: while I don't know about the specific Wesnoth/SDL code I can tell you that C++ doesn't allow unicode in ''. Those specify a char which is usually a 8 bit type. Most likely you'll never work on a system where it is not. For unicode you'd have to use something like
char character[4] = { 0x??, 0x??, 0x??, 0x?? }
depending on wheter you use UTF32 or UTF8/16 whatever it is of course a different amount of bytes that's required. IIRC correctly Wesnoth uses UTF8 internally as well so it'd be one to five or six bytes I don't know exactly how long the latest characters are already in UTF8. If wchar_t has the required size you can of course use that as well as an char array. In fact, use whatever makes the least trouble with SDL and assign each byte the correct value for the character you need.
Ryn: if you intend to work upon a hebrew translation, just contact the developers and I'm sure they'll work on adding support for it. Post 1.0 obviously as it is very near and hebrew would most likely require quite a few code changes.
char character[4] = { 0x??, 0x??, 0x??, 0x?? }
depending on wheter you use UTF32 or UTF8/16 whatever it is of course a different amount of bytes that's required. IIRC correctly Wesnoth uses UTF8 internally as well so it'd be one to five or six bytes I don't know exactly how long the latest characters are already in UTF8. If wchar_t has the required size you can of course use that as well as an char array. In fact, use whatever makes the least trouble with SDL and assign each byte the correct value for the character you need.
Ryn: if you intend to work upon a hebrew translation, just contact the developers and I'm sure they'll work on adding support for it. Post 1.0 obviously as it is very near and hebrew would most likely require quite a few code changes.
-
- Inactive Developer
- Posts: 294
- Joined: March 30th, 2004, 4:45 pm
- Location: Nîmes, France
- Contact:
C++ has no problem with Unicode. Depending on the encoding, using UTF-8-encoded strings in std::strings, or wider characters in std::wstrings, is a suitable solution to store unicode strings.torangan wrote:Ihsan: while I don't know about the specific Wesnoth/SDL code I can tell you that C++ doesn't allow unicode in ''. Those specify a char which is usually a 8 bit type.
However, SDL has some problems with dead keys, preventing many layouts of keyboards to enter accented characters properly.
İhsan, did you find how to solve this? This is would be a very welcome fix.
Ş is the unicode character u+015E (LATIN CAPITAL LETTER S WITH CEDILLA) You could try to use it as a wide char in C90 with something like
This has a chance to work (not tested) but depend of the library.
If you just type
the result will be editor dependant, either the 0xDE byte of ISO-8859-9 (turkish character set) and it will not work in the game, either two UTF-8 bytes 0xC4 0x9E and may fail at compile time.
Code: Select all
foo = L'\x015E' ;
If you just type
Code: Select all
foo = 'Ş' ;
I told just a way to type non ascii character within the c++ code. Theyre is probably not much.
Well, I've made some tests. When I type in the unit search box
Apparently I does not have the expected
but a instead
But if it type the sequence very quickly I have the right character.
Apparently some timer need to be adjusted on dead key.
Notice also that the Copy/Paste does not work well (on Mac OS X at least) with non ascii characters.
When a copy/paste I got "^" and a square. copying/pasting give nothing.
Well, I've made some tests. When I type in the unit search box
Code: Select all
dead ` + a
Code: Select all
ÃÂ
Code: Select all
a
But if it type the sequence very quickly I have the right character.
Apparently some timer need to be adjusted on dead key.
Notice also that the Copy/Paste does not work well (on Mac OS X at least) with non ascii characters.
When a copy/paste
Code: Select all
Ş
Code: Select all
ÃÂ
Hi. Actually I put the patch to savannah, However this patch is easy forAyin wrote: İhsan, did you find how to solve this? This is would be a very welcome fix.
Turkish characters, but when we consider the other languages
the programmers did not wanted to solve this in this way, because it
is a bug of sdl.
the link for the patch is here
http://savannah.nongnu.org/bugs/?func=d ... m_id=12169
it is self explained.
ihsan.
Westnoth is ruled by anNOYing King of Dragons