[Top][All Lists]

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

lynx-dev Tweaking HTML.c to insert characters (was: UTF-8 display questi

From: Klaus Weide
Subject: lynx-dev Tweaking HTML.c to insert characters (was: UTF-8 display questions)
Date: Thu, 8 Jun 2000 10:54:39 -0500 (CDT)

On 8 Jun 2000, Sergei Pokrovsky wrote:

> There's another question about lynx massaging.  I've changed the
> superscript rendition to my liking, but there are some other similar
> changes I'd like to make.  One is the DFN element.  I'd like to
> implement it with quotes in lynx.  The problem is that I'd like to have
> curly quotes if available.  Is it possible to specify Unicode quotes
> _and_ to be able to have a translation if they are missing in the
> current font/charset?  (For the time being I've put _underscore_
> there to mark DFN.)

There is no precedent for this kind of thing in HTML.c.  The text that
HTML.c functions see is generally already supposed to be in the final
(display character set) representation,  so you'd have to convert to that.
I would try something like the following, under'case HTML_DFN:' in
HTML_start_element (and soemthing equivalent in HTML_end_element):

     char replace_buf[8];       /* or bigger */
     if (
         UCTransUniCharStr(replace_buf, sizeof(replace_buf),
                           0x2018,      /* whatever Unicode character */
                           current_char_set, /* display character set */
                           1) >= 0
         ) {
       HTML_put_string(me, replace_buf);
     } else {
       /* UCTransUniCharStr shouldn't fail, but just in case, some
          fallback: */
        HTML_put_character(me, '`');

UCTransUniCharStr will just UTF-8-encode the Unicode value if
current_char_set says UTF-8, or return the correct byte if we're
in one of the windows-* D.C.S. that has this quote character, or
else return the replacement string normally from the def7_uni.tbl

This is completely untested; if you use it, let us know how it goes.


; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden

reply via email to

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