MantisBT - Open CASCADE
View Issue Details
0031171Open CASCADE[OCCT] OCCT:DRAWpublic2019-11-16 08:512019-11-24 11:35
[OCCT] 7.4.0 
[OCCT] 7.5.0 
0031171: Draw - support Unicode input / output in console on Windows
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).
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
No tags attached.
related to 0014673assigned abv Open CASCADE Provide true support for Unicode symbols 
png bug31171_fixed.png (13,731) 2019-11-16 15:37
Issue History
2019-11-16 08:51abvNew Issue
2019-11-16 08:51abvAssigned To => apn
2019-11-16 15:36abvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=22203#r22203
2019-11-16 15:37abvRelationship addedrelated to 0014673
2019-11-16 15:37abvFile Added: bug31171_fixed.png
2019-11-16 15:43abvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=22204#r22204
2019-11-16 15:44abvDescription Updatedbug_revision_view_page.php?rev_id=22206#r22206
2019-11-16 16:45gitNote Added: 0089017
2019-11-16 18:44gitNote Added: 0089028
2019-11-16 18:45abvNote Added: 0089029
2019-11-16 18:45abvStatusnew => resolved
2019-11-16 18:45abvAssigned Toapn => kgv
2019-11-16 19:56gitNote Added: 0089030
2019-11-16 19:56abvNote Added: 0089031
2019-11-17 11:34kgvNote Added: 0089032
2019-11-17 16:28abvNote Added: 0089033
2019-11-17 17:51abvRelationship addedrelated to 0031165
2019-11-17 17:54gitNote Added: 0089034
2019-11-17 17:56abvNote Added: 0089035
2019-11-18 11:44kgvAssigned Tokgv => bugmaster
2019-11-18 11:44kgvStatusresolved => reviewed
2019-11-18 11:44kgvProduct Version => 7.4.0
2019-11-18 19:17bugmasterTest case number => bugs/fclasses/bug22125
2019-11-20 17:05bugmasterNote Added: 0089104
2019-11-20 17:05bugmasterStatusreviewed => tested
2019-11-24 11:21abvChangeset attached => occt master 8f00325d
2019-11-24 11:21abvAssigned Tobugmaster => abv
2019-11-24 11:21abvStatustested => verified
2019-11-24 11:21abvResolutionopen => fixed
2019-11-24 11:35gitNote Added: 0089181

2019-11-16 16:45   
Branch CR31171 has been created by abv.

SHA-1: 5201e76f6fc96e61b595a2999385fd599de21c1a

Detailed log of new commits:

Author: abv
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
2019-11-16 18:44   
Branch CR31171 has been updated forcibly by abv.

SHA-1: 68eb42b5ada60de52935583b8152445715075d77
2019-11-16 18:45   
The fix is pushed to branch CR31171 and tested, see Jenkins job CR31171-abv; please review
2019-11-16 19:56   
Branch CR31171 has been updated forcibly by abv.

SHA-1: 660c58f42ba69ae29c36edbefb556ae07b2cff1c
2019-11-16 19:56   
Rebased on new master
2019-11-17 11:34   
--- 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?
2019-11-17 16:28   
Oops, my mistake
2019-11-17 17:54   
Branch CR31171 has been updated forcibly by abv.

SHA-1: 8f00325d73ba7521020db6e201786eaeab48cb75
2019-11-17 17:56   
Encoding of Draw_Main.cxx is corrected; alas the tools I normally use for viewing diffs do not show the changes in BOM...
2019-11-20 17:05   
Combination -
OCCT branch : WEEK-47
master SHA - 01ba59e958df3e8d3e19f5705a6e40d5574ee0c3
Products branch : WEEK-47 SHA - 0585a8b491d06a1c800faf77c3b79decb046c24f
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

No regressions/differences

CPU differences:
Total CPU difference: 16830.62000000013 / 16823.120000000046 [+0.04%]
Total CPU difference: 10816.570000000062 / 10787.080000000053 [+0.27%]
Total CPU difference: 18301.015625 / 18299.59375 [+0.01%]
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
2019-11-24 11:35   
Branch CR31171 has been deleted by inv.

SHA-1: 8f00325d73ba7521020db6e201786eaeab48cb75