The MB_String classes


About the Multi-byte String Classes for Tango

These classes provide:

  1. internationalized, multi-byte-aware alternatives to native Tango calls.
  2. extra features essential for operating in an international environment, notably translation between different character encoding systems.

MB_String functions can be accessed in two ways:

  1. Using the Tango Class File MB_String.tcf
  2. Using <@MB_ ...> custom tags.

The files

Downloading

All the files you need are contained in MB_String.zip (16.4K)

They comprise:

Licensing

GPL...

Help yourself, under the terms described here...

Installation

  1. Decompress MB_String.zip.
  2. Put MB_String.jar in a directory where your Tango server will find it.
  3. This can be either
    a) A directory on your Java classpath. (Type "set" if you want to know which directories are on your Java classpath.)
    or
    b) Somewhere referenced by your beanpath.ini file.

    Mine lives at
    c:\PVSW\Tango2000\java\MB_String.jar,
    and my beanpaths.ini file contains the line:
    C:\PVSW\Tango2000\java\MB_String.jar

  4. Put MB_String.tcf in a directory where your Tango server will find it.
    Tango server will look anywhere in your TCFSEARCHPATH as specified in your t4server.ini file.
    Mine lives at c:\\inetpub\wwwroot\Tango2000\Tcf\MB_String.tcf.
  5. Put MB_StringTag.xml in a directory where your Tango server will find it.
    Tango server will look anywhere in your CUSTOMTAGSPATH as specified in your t4server.ini file.
    Mine lives at C:\\PVSW\\Tango2000\\Configuration\\CustomTags\MB_StringTag.xml
  6. Put MB_StringTest.taf wherever you usually keep your Tango Application Files.
    Mine lives at C:\\inetpub\wwwroot\tafs\MB_StringTest.taf
  7. Put the Multi-byte String Functions snippets folder in the directory where the snippets live for your editor.
    Mine lives at C:\WINDOWS\Ed Edgar\My Snippets\Multi-byte String Functions.

How it works

The internationalized string processing is all done by the Java Bean MB_String.class, which wraps many of Java's native string functions.

The Tango Class File MB_String.tcf is reponsible for passing text to the Java Bean without breaking it.

Theoretically it should be possible to pass 8-bit bytes backwards and forwards between Java and Tango as if they are Tango's default ISO-8859-1, then turn them into proper strings on the Java side. However, this appears to break on the platform I have tested on (Win '98, Tango 2000). My guess is that high bytes are being stripped out somewhere. Feel free to try on your platform, though. The relevant Java Bean methods are:

If you can get this to work, I'd love to hear from you.

There are three possible alternatives, neither of them pretty:

  1. Write to a file, have the Java Bean read the file, then delete the file.
  2. Turn each byte into its numerical equivalent, join them together using an arbitrary delimiter have the Java Bean turn them into a string.
  3. A mixture of (1) and (2), using numerical transfer for short strings and file-based transfer for long ones.

So far I have implemented (2), which will be slow at the Tango end for very long strings.