Germanunkol / trAInsported

Löve2D Game
http://germanunkol.de/trainsported/
Other
163 stars 40 forks source link

in-game console can't handle diacritics #60

Open BozoDel opened 10 years ago

BozoDel commented 10 years ago

I recently started a Brazilian Portuguese translation of this game. While I was testing Tutorial 1, I came across a bug. I tell the player to add the command "print("Olá, trAIns")", and instead of printing it, I get the following error message:

Could not execute script: (TutorialAI1.lua): Scripts/console.lua:54: Not enough space 5: [/home/bozodel//.local/share//love/trAInsported/AI/TutorialAI1.lua]: line 11 6: [=[C]]: line -1 7: [@Scripts/ai.lua]: line 98

I read somewhere that this might be an issue with the engine? Could it have been fixed in 0.9.0?

I can get around that for the tutorial, replacing "Olá" with "Oi", but the player will eventually use diacritics and won't know what to do. If it's impossible to fix the issue, then maybe we can give people an error message telling them to remove diacritics?

P.S.: Is that why the tutorial translations haven't actually been implemented?

Germanunkol commented 10 years ago

Hi,

Yes, if I recall correctly this should be fixed with the new engine version. I am going to port it, hopefully soon. With a bit of luck, it will happen within the next week. The new engine version has only been out for about a month and I didn't get around to porting it yet. And yes, this is also part of the reason why the translations have not all been implemented and shipped. If you want to, maybe wait for a few days and let me port the game? Thanks for taking the time to translate it!

BozoDel commented 10 years ago

You're welcome! But hmyeah, maybe I should wait.

Germanunkol commented 10 years ago

Could you send me the script that fails to execute somehow? I'd love to try it myself... because I gave the problem some more thought: It's also possible that there's something wrong with the encoding, which would be independent of the engine.

BozoDel commented 10 years ago

Oh, it's really simple, just have the AI script print anything with diacritics. "print ('á')" will do.

Germanunkol commented 10 years ago

Yes, but I thought it might depend on how you save the file (encoding). But I tried it, and it fails here, too. I also remember why, now: It's because special characters need more than one byte, I need to handle that seperately. I'll look into it soon, when I port the game.

BozoDel commented 10 years ago

It's funny because it's just the console. Diacritics are fine everywhere else.

Germanunkol commented 10 years ago

Yes, it's my word wrapping algorithm. It only takes into account single byte letters - but special characters can't be represented by plain ascii and are thus multiple characters long. I got this fixed in another project I was working on, and will try to port that fix here.

hajo4 commented 10 years ago

When you are looking at "print" and special chars: is it possible to make a beep with "\a" ?

BozoDel commented 10 years ago

No, it doesn't beep. It prints a rectangle thingie. No error message though. What's "\a" supposed to be?

hajo4 commented 10 years ago

\a is control-char(7), aka "Alert" or "beep".