Archived issue #0031171
Draw - support Unicode input / output in console on Windows
Description
Currently DRAW is not configured properly to deal with Unicode symbols when working interactively on Windows. When Unicode text is used in command or output, in most cases either the text is output corrupted, or output pipeline gets blocked.
This can be fixed now for Windows 10 since it supports UTF8 codepage (65001).
This can be fixed now for Windows 10 since it supports UTF8 codepage (65001).
Steps to reproduce
Note: to be able to see non-Ascii symbols, make sure that the font used by the console supports these symbols. For the examples below, to be able to show hieroglyphs in the Windows' command window, I had to go to properties of the window, and on tab "Font" select "NSimSun" or "SimSun-ExtB" font.
Method A: the following DRAW command should output hierogliphs in file name, translated to Chinese as "it works":
test bugs fclasses bug22125 -echo
Method B: the following commands defines Korean text translated as "triangulation", sets it as name to OCAF label and prints name from OCAF; hierogliphs should be correct at both places (see attached image):
pload ALL
set n [encoding convertfrom utf-8 "\xec\x82\xbc\xea\xb0\x81\x20\xeb\xb6\x84\xed\x95\xa0"]
NewDocument D
SetName D 0:1 $n
GetName D 0:1
Method A: the following DRAW command should output hierogliphs in file name, translated to Chinese as "it works":
test bugs fclasses bug22125 -echo
Method B: the following commands defines Korean text translated as "triangulation", sets it as name to OCAF label and prints name from OCAF; hierogliphs should be correct at both places (see attached image):
pload ALL
set n [encoding convertfrom utf-8 "\xec\x82\xbc\xea\xb0\x81\x20\xeb\xb6\x84\xed\x95\xa0"]
NewDocument D
SetName D 0:1 $n
GetName D 0:1
Public activity
11 archived notes
Participants are labeled by their role within this record.
Branch [archived branch] has been created by Author.
[revision removed]
Detailed log of new commits:
Author: Author
Date: Sat Nov 16 08:59:38 2019 +0300
0031171: Draw - support Unicode input / output in console on Windows
System console is configured at DRAW start to use UTF-8 encoding, for cout and cin to deal correctly with Unicode symbols.
Use of std::wcout is avoided as it leads to corrupted output.
Command testgrid is improved to enforce UTF-8 encoding in child DRAW processes to preserve Unicode symbols in captured output.
Test bugs fclasses bug22125 is refactored:
- avoid dependency on external data file
- avoid producing snapshot
- check that Unicode name of the file created by OCCT procedure matches the name interpreted by Tcl functions
[revision removed]
Detailed log of new commits:
Author: Author
Date: Sat Nov 16 08:59:38 2019 +0300
0031171: Draw - support Unicode input / output in console on Windows
System console is configured at DRAW start to use UTF-8 encoding, for cout and cin to deal correctly with Unicode symbols.
Use of std::wcout is avoided as it leads to corrupted output.
Command testgrid is improved to enforce UTF-8 encoding in child DRAW processes to preserve Unicode symbols in captured output.
Test bugs fclasses bug22125 is refactored:
- avoid dependency on external data file
- avoid producing snapshot
- check that Unicode name of the file created by OCCT procedure matches the name interpreted by Tcl functions
Branch [archived branch] has been updated forcibly by Author.
[revision removed]
[revision removed]
The fix is pushed to branch CR31171 and tested, see Jenkins job CR31171-abv; please review
Branch [archived branch] has been updated forcibly by Author.
[revision removed]
[revision removed]
Rebased on new master
--- a/src/Draw/Draw_Main.cxx +++ b/src/Draw/Draw_Main.cxx @@ -1,4 +1,4 @@ -// Created on: 1999-12-30 +\feff// Created on: 1999-12-30
Why BOM is suddenly needed here?
Oops, my mistake
Branch [archived branch] has been updated forcibly by Author.
[revision removed]
[revision removed]
Encoding of Draw_Main.cxx is corrected; alas the tools I normally use for viewing diffs do not show the changes in BOM...
Combination -
OCCT branch : [archived branch]
master SHA - [revision removed]
[revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.
Number of compiler warnings:
No new/fixed warnings
Regressions/Differences/Improvements:
No regressions/differences
CPU differences:
Debian80-64:
OCCT
Total CPU difference: 16830.62000000013 / 16823.120000000046 [+0.04%]
Products
Total CPU difference: 10816.570000000062 / 10787.080000000053 [+0.27%]
Windows-64-VC14:
OCCT
Total CPU difference: 18301.015625 / 18299.59375 [+0.01%]
Products
Total CPU difference: 12814.90625 / 12853.21875 [-0.30%]
Image differences :
No differences that require special attention
Memory differences :
No differences that require special attention
OCCT branch : [archived branch]
master SHA - [revision removed]
[revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.
Number of compiler warnings:
No new/fixed warnings
Regressions/Differences/Improvements:
No regressions/differences
CPU differences:
Debian80-64:
OCCT
Total CPU difference: 16830.62000000013 / 16823.120000000046 [+0.04%]
Products
Total CPU difference: 10816.570000000062 / 10787.080000000053 [+0.27%]
Windows-64-VC14:
OCCT
Total CPU difference: 18301.015625 / 18299.59375 [+0.01%]
Products
Total CPU difference: 12814.90625 / 12853.21875 [-0.30%]
Image differences :
No differences that require special attention
Memory differences :
No differences that require special attention
Branch [archived branch] has been deleted by Participant.
[revision removed]
[revision removed]
Related records