Kbase P184489: Enhancement Request for the Format Phrase to calculate using characters rather than bytes for scenar
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  03/05/2011 |
|
Status: Verified
GOAL:
Enhancement Request for the Format Phrase to calculate using characters rather than bytes for scenarios of Double-byte (DBE) and Multi-byte language use.
GOAL:
Format Phrase requested to be enhanced to calculate the length using characters.
FACT(s) (Environment):
Format Phrase currently calculates length using bytes
All Supported Operating Systems
OpenEdge 10.x
CAUSE:
Enhancement Request# OE00205926
FIX:
Workaround 1:
Define the Format Phrase to account for the additional DBE bytes, such as "XXXX-XXXX" or something similar. This solution might not work well when there is an irregular mix of Single and Double/Multi byte characters. For example:
S = Single-Byte
D = Double-Byte
With an original format phrase of "XX-XX", the following is what is shown:
Intended format Format XX-XX Format XXXX-XXXX:
SS-SS SS-SS SSSS
DD-SS D-D DD-SS
DS-DS D-S DS-DS
Workaround 2:
Use SUBSTRING to split and re-join based upon characters rather than bytes. Using a Function just makes it easier to use with multiple occurrences and also makes it easier to read the code.
DEFINE VARIABLE mycode AS CHAR INIT "²âÊÔAB" NO-UNDO.
FUNCTION f2-2 RETURNS CHAR (INPUT inchar AS CHAR):
RETURN SUBSTRING(inchar,1,2) + "-" + SUBSTRING(inchar,3,2).
END.
MESSAGE f2-2(mycode) VIEW-AS ALERT-BOX.