realnc / frobtads

Linux and macOS development tools and text-mode interpreter for TADS adventure games.
49 stars 12 forks source link

Mutated vowels are not rendered correctly while entering text in an UTF8-t3 file using the curses interface. #4

Open goto40 opened 5 years ago

goto40 commented 5 years ago

I use https://github.com/mikawa/G-TADS to create a german TADS project. I installed the 'de_de' files from there.

I created an example project with

beispiel.t

#charset "utf8"
//...
#include <adv3.h>
#include <de_de.h>
//...
startRoom: Room 'Startraum'
    "Das ist der Startraum. Umlaute sind ÄÖÜ äöü ß etc... Gib 'über' ein..."
;

Then i compile my project and I run the t3-file:

frob -k utf8 beispiel.t3

The output is ok (I see the mutated vowel rendered correctly with the curses interface).

However, if I enter a mutated vowel I get "??" instead of the vowel (e.g. '??ber' instead of 'über'). The text is interpreted correctly, only the rendered input text is wrong.

Note: with the plain interface works as expected.

realnc commented 5 years ago

The part of the TADS base code that deals with character-oriented displays (osgen3.c) does not actually support Unicode. It always assumes the text consists of one byte (8 bits) per character. UTF-8 output kind of works only because it's compatible with 8-bit text when sending it to the various osgen3 text functions. But these functions do not actually treat it correctly, even if it appears to display mostly correctly. They get the text length wrong and as such there's some glitches even on output.

Input, however, is where this problem really shows, because each single character matters and getting one character wrong results in the rest not being parsed correctly.

I'm not sure what to do about this. I'd need to implement an osgen3 replacement that is Unicode-aware. No immediate plans for this right now, so this bug will probably remain open for a while.