Archive of UserLand's first discussion group, started October 5, 1998.

Re: Easy road to Double Byte in Frontier Land

Author:Lixian B. Chiu
Posted:4/15/1999; 10:14:41 AM
Topic:Easy road to Double Byte in Frontier Land
Msg #:5042 (In response to 5035)
Prev/Next:5041 / 5043

Here are the firstFilter and finalFilter script. The TEC osax is extremely fast, I couldn't tell any difference in terms of rendering time when using it. It might be because it's just an interface to the Text Encoding Converter, and the TEC (the converter, not the osax) has been highly optimized by Apple.

One thing to note is that if your double byte text contains non-standard character, you will have problem converting from UTF-8 back to the original encoding. I have some Big-5 text that contains user-defined characters, while I could convert to UTF-8 w/o problems, converting back to Big-5 just gave me some question marks back.

If anyone is interested in writing a DLL, it would be nice to have a way to apply a different mapping table than the default.

Back to the filter scripts. To use the scripts, you need to set a charset directive. Make it the name of your pages' character encoding. Also, make sure #isoFilter is false. Also, remember to get the TEC osax (http://www.bekkoame.ne.jp/~iimori/sw/TECOSAX.html).

on firstFilter (adrPageTable) {

      bundle { <             local {

                  s;

                  typeOfObj = typeOf (adrPageTable^.adrobject^)};

            case typeOfObj {

                  stringType {

                        adrPageTable^.originalObject = adrPageTable^.adrobject^;

                        adrPageTable^.adrobject^ = TEC.ConvertText (adrPageTable^.adrobject^, adrPageTable^.charset, "UTF-8")};

                  outlineType {

                        new (outlineType, @adrPageTable^.originalObject);

                        adrPageTable^.originalObject = adrPageTable^.adrobject^;

                        s = string (adrPageTable^.adrobject^);

                        s = TEC.ConvertText (s, adrPageTable^.charset, "UTF-8");

                        op.newOutlineObject (s, adrPageTable^.adrobject)};

                  wpTextType {

                        new (wpTextType, @adrPageTable^.originalObject);

                        adrPageTable^.originalObject = adrPageTable^.adrobject^;

                        s = string (adrPageTable^.adrobject^);

                        s = TEC.ConvertText (s, adrPageTable^.charset, "UTF-8");

                        wp.newTextObject (s, adrPageTable^.adrobject)}}};

      return (true)}

 

 

on finalFilter (adrPageTable) {

      bundle { <             adrPageTable^.adrobject^ = adrPageTable^.originalObject;

            adrPageTable^.renderedText = TEC.ConvertText (adrPageTable^.renderedText, "UTF-8", adrPageTable^.charset)};

      return (true)}




There are responses to this message:


This page was archived on 6/13/2001; 4:49:22 PM.

© Copyright 1998-2001 UserLand Software, Inc.