Code translation is required in exchanging data between host and PC. Required considerations are:
As described before, each DBCS portion is bracketed by SO (Shift Out) and SI (Shift In) control codes in order to distinguish DBCS characters from SBCS characters in mixed strings of host code. These SO/SI control codes are one-byte data in the host data stream while there is no SO/SI in PC data stream. So, in code translation of SBCS/DBCS mixed strings, the data length may decrease in down-loading and may increase in up-loading. See ES_MIXED for relevant information.
If you provide a conversion function by yourself, consider the following:
An SBCS code translation table for US English cannot be shared by the other country because of differences among each countries character set and code page. So, you must prepare your translation table by referring each countries' host code table and PC code table.
Your translation table should be customizable since code points for PC code and host code may not have a one to one correspondence and how to cope with this depends on the user's application. (Code translations between the extended code pages of the same country does not have this problem because of the common character set.)
The DBCS system allows a customer to define his/her own characters (called user defined characters, UDC) and assign them to code points in a certain code range. Relationship between host UDC and PC UDC depends on the customer's code point assignments. So, the code translation table for UDC should be customizable.