Email list hosting service & mailing list manager

finishing output translating stream Shiro Kawai (25 May 2005 00:05 UTC)
Re: finishing output translating stream Michael Sperber (06 Jun 2005 15:15 UTC)
Re: finishing output translating stream Shiro Kawai (07 Jun 2005 10:41 UTC)
Re: finishing output translating stream bear (07 Jun 2005 16:12 UTC)
Re: finishing output translating stream Michael Sperber (08 Jun 2005 07:19 UTC)
Re: finishing output translating stream Shiro Kawai (08 Jun 2005 07:37 UTC)
Re: finishing output translating stream Michael Sperber (08 Jun 2005 07:52 UTC)
Re: finishing output translating stream Shiro Kawai (08 Jun 2005 09:08 UTC)
Re: finishing output translating stream Shiro Kawai (08 Jun 2005 09:10 UTC)
Re: finishing output translating stream bear (08 Jun 2005 18:10 UTC)
Re: finishing output translating stream bear (09 Jun 2005 02:16 UTC)
Re: finishing output translating stream Michael Sperber (09 Jun 2005 05:51 UTC)
Re: finishing output translating stream Shiro Kawai (21 Jun 2005 00:00 UTC)
Re: finishing output translating stream Michael Sperber (22 Jun 2005 07:56 UTC)

finishing output translating stream Shiro Kawai 25 May 2005 00:05 UTC

Hi,

Is there any way for <translate-proc> of make-translated-output-stream
to know if the translated output stream is flushed or closed?

It is necessary for implementing character encoding conversion, since
character encodings may have states, which should be cleared
depending on the next output character or if there's no more output
characters.

An example: Suppose I'm writing a translating output stream that
receives utf8 string and produces iso-2022 encoded string.
Iso-2022 is a stateful encoding, switching "current code sets"
with escape sequences.  And it is required that the encoding
string should end with code set #0 (default one).  If the last
character of the original output is in other code set than #0,
the translate-proc should write out extra bytes to reset the
code set.

Another example: Even Unicode can be stateful in regard to other
encoding systems.   When I'm converting utf-8 to jisx0213,
strictly following the specification, there are a few Unicode
characters I need to peek at the next character or EOF state to
determine the corresponding jisx0213 character.
For example, unicode character <U+30AB> becomes jisx0213 <0xA5AB>,
except the sequence <U+30AB> <U+309A>, which becomes <0xA5F7>.
If the last character of the original output is <U+30AB>, the
translate-proc needs to know it's the last one.

--shiro