gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unicode I/O for GM2


From: Benjamin Kowarsch
Subject: Re: Unicode I/O for GM2
Date: Mon, 25 Mar 2024 21:18:08 +0900

On Mon, 25 Mar 2024 at 01:24, Alice Osako wrote:

While the immediate concern is the test module, which is meant to show that the test characters are correctly manipulated by displaying them to the console, there is a general need for an I/O library for both file and console I/O.

I've tried to solve this problem a few different ways, first using the ISO RawIO operations Read and Write, then with the GCC Base library operations ReadNBytes and WriteNBytes. While I have not tested how they work for file I/O yet, for console I/O the displayed characters are being truncated to display only the first byte of the wide character:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 0: 'a' [U+0061] is a valid codepoint; is a printable ASCII character; is in the BMP. -> 97 -> 'a'
 1: 'a' [U+0061] is a valid codepoint; is a printable ASCII character; is in the BMP. -> 97 -> 'a'
 2: 'a' [U+0061] is a valid codepoint; is a printable ASCII character; is in the BMP. -> 97 -> 'a'
 3: ' ' [U+0120] is a valid codepoint; is not a printable ASCII character; is in the BMP. -> 32 -> ' '
 4: '�' [U+00C1] is a valid codepoint; is not a printable ASCII character; is in the BMP. -> 193 -> '�'
 5: '�' [U+00C1] is a valid codepoint; is not a printable ASCII character; is in the BMP. -> 193 -> '�'
 6: 'A' [U+0141] is a valid codepoint; is not a printable ASCII character; is in the BMP. -> 65 -> 'A'
 7: '' [U+FFFD] is a valid codepoint; is not a printable ASCII character; is in the BMP. -> 29 -> ''

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

My hunch is that the console device driver used by GM2's ISO I/O library is designed only for single-byte character output.

If so, then the device driver will either need to be modified or replaced/bypassed.

To verify this will require some digging, though. Maybe Gaius can shed some light on it.

In the meantime, I would recommend writing the test output into a file. When individual bytes to a file they should not be interpreted as characters by the I/O subsystem. You can then echo the file contents to the console using the shell.

regards
benjamin

reply via email to

[Prev in Thread] Current Thread [Next in Thread]