Sun Java Solaris Communities My SDN Account
 

Tutorials & Code Camps
MBE Tutorial
  « Previous | Contents | Next »
 

-




The Multibyte English (MBE) locale contains four encodings of English characters:
  1. ASCII (7-bit, 1 byte)
  2. Japanese Extended UNIX® Code (EUC) full size ASCII characters (2 bytes)
  3. Japanese shift-JIS (SJIS) full size ASCII characters (2 bytes)
  4. Private MBE encoding (3-4 bytes)
The ASCII characters are displayed in the MBE locale in the Lucida font type. The other three encodings are all displayed using the same double wide font.

The Japanese EUC encoding is provided for partial compatability with XView applications because the XView toolkit has dependencies on EUC encoded characters and will not display the SJIS or private MBE encodings. The SJIS encoding is provided for Java applications which must use an encoding that is supported within the Java environment. The default MBE encoding is dependent upon the MBE locale. For en_FW.MBE locale, the default MBE encoding is the private MBE encoding. For en_FW.PCK locale, the default MBE encoding is the SJIS encoding. The Japanese EUC is only used in XView message catalogs but can be selected with the -e option of the conversion utilities.

NOTE: The private MBE encoding is more complex than either the Japanese EUC encoding or the SJIS encoding and should be used for internationalization testing whenever possible.

To quickly reveal internationalization bugs, MBE does not sort the code values by ASCII encoding. Some code values are unusual. The table below shows the code values for the MBE space, A, B, and C characters. NOTE: The multibyte space in MBE contains the ASCII space character as one of its bytes.

CharacterFirstSecondThirdFourth
MBE Space0x830x40(@)0x20(sp)
MBE A0x840x60(`)0x41(A)0x41(A)
MBE B0x840x61(a)0x42(B)0x42(B)
MBE C0x840x62(b)0x43(C)0x43(C)

For all of the code values in MBE, see Section A.2, MBE Characters.

Multibyte English (MBE) locale provides utilities and functions to convert codes from ASCII to MBE and from MBE to ASCII.

Utilities

If you are testing your editor application in MBE, you must input text in MBE to check that the application loads the text correctly. To generate a text file in MBE, you can use the entombe(1) program to convert text from ASCII to MBE.

  system% entombe abc.txt> mbe.txt
  

Load the mbe.txt file into the editor and verify that the contents are displayed correctly.

You can also verify that the mbe.txt file was saved correctly by saving it and then using the mbetoen(1) program to convert codes from MBE to ASCII.

  system% mbetoen mbe.txt> abc2.txt
  

You can compare the abc2.txt file with the original abc.txt file.

Functions

You can create your own converter by using the entombe(3x) and mbetoen(3x) functions.

       #include <mbe.h>
  
       int entombe (char * str , const int c ,      int mbe );
       int mbetoen (int * c ,    const char * str , int mbe );
  
The binary must be statically linked with the /usr/lib/libmbe.a libary. For example:
       system% cc -o test test.c -lmbe
  
top
  « Previous | Contents | Next »
 

Oracle is reviewing the Sun product roadmap and will provide guidance to customers in accordance with Oracle's standard product communication policies. Any resulting features and timing of release of such features as determined by Oracle's review of roadmaps, are at the sole discretion of Oracle. All product roadmap information, whether communicated by Sun Microsystems or by Oracle, does not represent a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. It is intended for information purposes only, and may not be incorporated into any contract.