gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Character issue in devkitPro/libnds.

#159684 - Dark Knight ez - Fri Jul 04, 2008 10:06 am

So I tracked down some awkwardness.
When I print out '?' to screen as value, I get 201 when I expected 144. The character printed out when printing out ? was actually the one associated with 201 at asciitable.com (read: not ?). Fun stuff.

Now, I looked up what had ? as 201, and that was web characters (amongst others?) long url

So, inconsistency between what the default console prints, and what is stored internally. Not sure whether the console printing needs adjusting, or the internal used ascii table by devkitPro, or something? I'm no expert on these matters. I just know this is terribly awkward.
_________________
AmplituDS website

#159685 - chishm - Fri Jul 04, 2008 10:19 am

Try saving your source file with the correct character encoding. In this case it is code page 437, more commonly called extended ASCII.
_________________
http://chishm.drunkencoders.com
http://dldi.drunkencoders.com

#159686 - Maxxie - Fri Jul 04, 2008 10:20 am

Ascii is 7 bits width. Ascii #201 does not really exist.
There is no unique setup of the chars >127

These were added to the original ascii table in form of several different (mostly language/country dependend) codepages. It is therefor very natural that the code's meanings are different between platforms maintained in different codepage-zones.

:edit: what chishm said ;)
_________________
Trying to bring more detail into understanding the wireless hardware

#159687 - Dark Knight ez - Fri Jul 04, 2008 10:39 am

Ah, I see. I guess I'll be working with codes rather than their symbols when handling my (textfile) maps with values beyond 127, and not assume what the symbols will end up when writing them to a file. Thanks for the explanation.

Edit:
For what it's worth, Programmer's Notepad (the default text editing app that comes with devkitPro) doesn't seem to have such a code page (yet).
_________________
AmplituDS website

#159689 - Maxxie - Fri Jul 04, 2008 11:01 am

Well the value will keep the same, it is just the symbal that is used to display it.

This is in most cases not application dependend but an OS Setting.
For windows this is the "Region and language settings" (manually tranbslated from german version, so the actual name might differ)
_________________
Trying to bring more detail into understanding the wireless hardware