Home News Features Games Authoring Community Forums About Contact
   

May 20, 2013, 12:33:30 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Unicode?  (Read 1716 times)
Trumgottist
Maker of SLUDGE
Longtime Member
*****
Offline Offline

Gender: Male
Posts: 1162



WWW
« on: November 03, 2011, 09:57:44 AM »

As demonstrated by this thread, SLUDGE currently does not handle Unicode text. The engine has a long history, so it assumes that a string consists of a sequence of single byte characters. Originally, it didn't care what those characters were, but when it turned multi-platform I made the decision to use ISO 8859-1, as that's what's standard on western versions of Windows, so it's what I had used in my game.

So far the history lesson. Let's look at the future. I'm considering switching the engine over to Unicode. Doing so will make the character handling slightly slower, and make use of a bit more memory, but I think and hope it's not a noticeable difference. But before doing the work, I'm throwing this post out here to see if anyone have any objections, or has something important in mind that I may have missed.
Logged

"Programming is the computer game that makes all others possible." - Ron Newcomb
BigMc
SLUDGE Linux/GTK+ Maintainer
Sr. Member
****
Offline Offline

Posts: 266



« Reply #1 on: November 03, 2011, 04:42:22 PM »

I'm all for it. I don't think it will slow the engine down conciderably.
Logged
Trumgottist
Maker of SLUDGE
Longtime Member
*****
Offline Offline

Gender: Male
Posts: 1162



WWW
« Reply #2 on: November 03, 2011, 04:49:06 PM »

Ok. Then I'll get started.
Logged

"Programming is the computer game that makes all others possible." - Ron Newcomb
BigMc
SLUDGE Linux/GTK+ Maintainer
Sr. Member
****
Offline Offline

Posts: 266



« Reply #3 on: November 04, 2011, 03:26:56 AM »

What about backwards compatibility of the Dev Kit? I suggest that we drop support for non UTF-8 scripts and translation files. Otherwise it will become ugly and converting some text files to another encoding is not such a big deal. We can provide a howto in the documentation.
Logged
BigMc
SLUDGE Linux/GTK+ Maintainer
Sr. Member
****
Offline Offline

Posts: 266



« Reply #4 on: November 29, 2011, 04:52:16 PM »

I want to save this and I can as well do it here already. On Linux a SLUDGE project can be converted to UTF-8 like this (from the project folder). Use with care and always make a backup of the project before! Using the command twice will probably damage the project.

Code:
for i in $(find . -iname '*.slu' -o -iname '*.tra' -o -iname '*.sld'); do iconv --from-code=ISO-8859-1 --to-code=UTF-8 -o $i $i; done
Logged
BigMc
SLUDGE Linux/GTK+ Maintainer
Sr. Member
****
Offline Offline

Posts: 266



« Reply #5 on: January 02, 2012, 04:35:07 PM »

I found a funny bug and I guess it's caused by the UTF8 transition. If I hit backspace when entering a name for a OOO save game, it will write "backspace" into the field instead of removing a character. Same goes for other keys like enter.
Logged
Trumgottist
Maker of SLUDGE
Longtime Member
*****
Offline Offline

Gender: Male
Posts: 1162



WWW
« Reply #6 on: January 02, 2012, 05:30:57 PM »

Fun bug. Smiley I'll look into it.
Logged

"Programming is the computer game that makes all others possible." - Ron Newcomb
Trumgottist
Maker of SLUDGE
Longtime Member
*****
Offline Offline

Gender: Male
Posts: 1162



WWW
« Reply #7 on: January 03, 2012, 10:41:05 AM »

This was an interesting bug-hunt, but I've now found it. Apparently OoO uses inFont() in an unusual way to determine if a keypress is special, and that's where the bug was. I had to step through the code slowly in the debugger to track it down.
Logged

"Programming is the computer game that makes all others possible." - Ron Newcomb
Trumgottist
Maker of SLUDGE
Longtime Member
*****
Offline Offline

Gender: Male
Posts: 1162



WWW
« Reply #8 on: January 03, 2012, 12:42:12 PM »

(Now I just have to fix substring(), which I discovered I also had broken.)
Logged

"Programming is the computer game that makes all others possible." - Ron Newcomb
Trumgottist
Maker of SLUDGE
Longtime Member
*****
Offline Offline

Gender: Male
Posts: 1162



WWW
« Reply #9 on: January 03, 2012, 02:10:38 PM »

…and done.
Logged

"Programming is the computer game that makes all others possible." - Ron Newcomb
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.8 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
 
Unauthorised reproduction of anything on this website is not allowed without our written consent.
Materials on this site are the property of their respective owners. Copyright © Adventure Developers. All rights reserved.