Kbase P177487: Filenames created in a UTF-8 session do not look correct.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  17/11/2010 |
|
Status: Unverified
SYMPTOM(s):
Filenames created in a UTF-8 session do not look correct.
Files created with the SAVE method do not look correct in Windows explorer.
The resulting file name appears to be longer and with several strange characters.
FACT(s) (Environment):
The filename contains extended characters.
Extended characters in the filename are encoded with the UTF-8 code page.
The session is a UTF-8 session started with -cpinternal UTF-8 -cpstream UTF-8.
Windows
OpenEdge 10.x
CAUSE:
The problem is that file name is encoded in UTF-8 but Microsoft Windows does not support UTF-8 (a multi byte encoding of Unicode). By default Windows supports its own single byte code pages as well as Unicode.
FIX:
To resolve the issue convert the output file name to the equivalent micorsoft single byte code page - in this case 1252 (Western European Windows). For example:
DEFINE VARIABLE lcFile AS CHARACTER NO-UNDO INIT 'c:\temp\ÉéÈèÊêËë.xml'.
DEFINE VARIABLE hDoc AS HANDLE NO-UNDO.
DELETE WIDGET-POOL "XML":U NO-ERROR.
CREATE WIDGET-POOL "XML":U.
/* Convert filename to 1252 */
lCFILE = codepage-convert(lcFile,"1252","UTF-8").
CREATE X-DOCUMENT hDoc IN WIDGET-POOL "XML":U.
hDoc:ENCODING = 'utf-8':U.
hDoc:SAVE('file':u,lcFile).
If at all possible it is recommended to avoid using extended characters for filenames and stick to ASCII a-z, A-Z. Using file names with extended characters will always be problematic. For the same reasons similar issues can be experienced searching for and reading in files names with extended characters.