[Top][All Lists]

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

UTF-8 and new ports

From: Mike Gran
Subject: UTF-8 and new ports
Date: Thu, 14 Feb 2008 13:40:35 -0800 (PST)


Suppose I'm creating a new Guile port type that is
going to use NCurses primitives for input (scm_getc)
and output (display).  NCurses can both receive input
and display output of wide characters, but, these
functions operate on 32-bit wide unicode codepoints,
aka UTF32.

It seems that port types are inherently 8-bit, right? 
So to make this work, the ports will have to store and
transmit characters as UTF-8 encoded data.  The
'fill_input' function will have to convert UTF-32 to
UTF-8 and then cache them, passing them 1 byte at a
time as requested.  The 'write' function will receive
data 1 byte at a time and buffer it.  It will only
write the character when a complete UTF-32 codepoint
has been received.

Sound right?

Has anyone already done this sort of thing?

Mike Gran

reply via email to

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