Try OpenEdge Now
skip to main content
Internationalizing Applications
Using Unicode : Using Unicode with OpenEdge applications : Unicode application example
 

Unicode application example

Creating and running an application that uses Unicode is not difficult. The following is an example of creating and running an application consisting of a database server, a graphical client, and a UTF-8 database.
To create the application:
1. Convert the database to Unicode using one of the techniques in Using Unicode with OpenEdge databases.
2. Design queries that access only records that use the client's code page.
One way to do this is for tables to have a field indicating the record's code page. When records are added, the field is populated. When the database is queried, the query references the code page field to return only those records in the client's code page.
Imagine that in the Sports database, the Customer table has a field, db-language, indicating the code page or language of the record. A client whose language corresponds to the value of the variable user-language might submit a query like the following:
FOR EACH Customer NO-LOCK WHERE SESSION:CPINTERNAL <> "UTF-8" OR
  db-language = user-language:
  DISPLAY Customer.Name Customer.Address Customer.City Customer.Country
    Customer.Comments.
END.
3. Start an OpenEdge database server, setting the server's code page to UTF-8. The following command fragment illustrates this:
proserve -cpinternal utf-8 -cpstream ...
4. Start a client in the native code page (perhaps ISO8859-15). Set -cpinternal, -cpstream, and the other code-page-related startup parameters to this code page. The following command illustrates this:
prowin32 -cpinternal iso8859-15 -cpstream iso8859-15
Your Unicode application is up and running.