1 puts "================"
2 puts "0028454: Data Exchange - Names with Special Characters Cannot Be Read from STEP or IGES Files"
3 puts "Target encodings: ISO 8859-1, ISO 8859-2, ISO 8859-3, ISO 8859-4, ISO 8859-5, ISO 8859-6,, ISO 8859-7, ISO 8859-8"
5 puts "1) Creates a temporary STEP file-template using WriteStep."
6 puts "2) Reads generated template and replaces @tmp_name@ entity in it with target language characters using Tcl."
7 puts "3) Generates 2 STEP files in UTF-8 and ISO 8859-(N) encodings (converted by Tcl)."
8 puts "4) Reads generated files using StepRead and validates entity name."
9 puts "================"
12 proc fileToString { thePath } {
13 set aFile [open "$thePath" r]
14 set aText [read $aFile [file size "$thePath"]]
19 proc fileFromString { thePath theContent theCodePage } {
20 set aFile [open "$thePath" w]
21 fconfigure $aFile -translation lf -encoding "$theCodePage"
22 puts $aFile $theContent
26 proc fileCreateAndCompare { thePathFrom theUtfPathTo theCpPathTo theNameFrom theNameTo theCodePage } {
27 regsub -all -- $theNameFrom [fileToString "$thePathFrom"] "$theNameTo" aContent
28 set aPathTo $theCpPathTo${theCodePage}.stp
29 fileFromString "$theUtfPathTo" "$aContent" "utf-8"
30 fileFromString "$aPathTo" "$aContent" "$theCodePage"
32 param read.step.codepage UTF8
33 ReadStep U "$theUtfPathTo"
35 param read.step.codepage "$theCodePage"
36 ReadStep ISO "$aPathTo"
38 if { [GetName U 0:1:1:1] != "$theNameTo" } { puts "Error: unable to read UTF-8 STEP" }
39 if { [GetName ISO 0:1:1:1] != "$theNameTo" } { puts "Error: unable to read $theCodePage STEP" }
40 if { [GetName A 0:1:1:1] == "$theNameTo" } { puts "Error: broken test case" }
46 pload XDE OCAF MODELING VISUALIZATION
47 set aTmpNameTmpl "@tmp_name@"
48 set aTmpFileTmpl "${imagedir}/${casename}-tmp.stp"
49 set aTmpFileUtf8 "${imagedir}/${casename}-tmp-utf8.stp"
50 set aTmpFileISO8859N "${imagedir}/${casename}-tmp-"
52 # "Test" (english multi-encoding) + "Test" (encoding in the target language)
55 set anEngName [encoding convertfrom utf-8 "\x54\x65\x73\x74"]
57 set iso8859_1 [encoding convertfrom utf-8 "\x50\x72\x6f\x62\xed\x68\xe1"]
59 set iso8859_2 [encoding convertfrom utf-8 "\x50\x72\x6f\x62\xed\x68\xe1"]
61 set iso8859_3 [encoding convertfrom utf-8 "\xd6\x6c\xe7\x65\x6b"]
63 set iso8859_4 [encoding convertfrom utf-8 "\x6d\xc4\x93\xc4\xa3\x69\x6e\x69\x65\x74"]
65 set iso8859_5 [encoding convertfrom utf-8 "\xD0\xa2\xD0\xB5\xD1\x81\xD1\x82"]
67 set iso8859_6 [encoding convertfrom utf-8 "\xd8\xa7\xd8\xae\xd8\xaa\xd8\xa8\xd8\xa7\xd8\xb1"]
69 set iso8859_7 [encoding convertfrom utf-8 "\xce\xb4\xcf\x80\xce\xa8\xce\xae"]
71 set iso8859_8 [encoding convertfrom utf-8 "\xc2\xb1\xd7\xa4\xd7\x9e\xd7\x9c\xd7\xa9"]
73 set iso8859_9 [encoding convertfrom utf-8 "\xc4\x9f\xc5\x9f\xc4\x9e\xc5\x9e\xc3\x86"]
84 SetName T 0:1:1:1 "$aTmpNameTmpl"
86 WriteStep T "$aTmpFileTmpl"
89 set aName "$anEngName $iso8859_1"
90 fileCreateAndCompare "$aTmpFileTmpl" "$aTmpFileUtf8" "$aTmpFileISO8859N" "$aTmpNameTmpl" "$aName" "iso8859-1"
93 set aName "$anEngName $iso8859_2"
94 fileCreateAndCompare "$aTmpFileTmpl" "$aTmpFileUtf8" "$aTmpFileISO8859N" "$aTmpNameTmpl" "$aName" "iso8859-2"
97 set aName "$anEngName $iso8859_3"
98 fileCreateAndCompare "$aTmpFileTmpl" "$aTmpFileUtf8" "$aTmpFileISO8859N" "$aTmpNameTmpl" "$aName" "iso8859-3"
101 set aName "$anEngName $iso8859_4"
102 fileCreateAndCompare "$aTmpFileTmpl" "$aTmpFileUtf8" "$aTmpFileISO8859N" "$aTmpNameTmpl" "$aName" "iso8859-4"
105 set aName "$anEngName $iso8859_5"
106 fileCreateAndCompare "$aTmpFileTmpl" "$aTmpFileUtf8" "$aTmpFileISO8859N" "$aTmpNameTmpl" "$aName" "iso8859-5"
109 set aName "$anEngName $iso8859_6"
110 fileCreateAndCompare "$aTmpFileTmpl" "$aTmpFileUtf8" "$aTmpFileISO8859N" "$aTmpNameTmpl" "$aName" "iso8859-6"
113 set aName "$anEngName $iso8859_7"
114 fileCreateAndCompare "$aTmpFileTmpl" "$aTmpFileUtf8" "$aTmpFileISO8859N" "$aTmpNameTmpl" "$aName" "iso8859-7"
117 set aName "$anEngName $iso8859_8"
118 fileCreateAndCompare "$aTmpFileTmpl" "$aTmpFileUtf8" "$aTmpFileISO8859N" "$aTmpNameTmpl" "$aName" "iso8859-8"
121 set aName "$anEngName $iso8859_9"
122 fileCreateAndCompare "$aTmpFileTmpl" "$aTmpFileUtf8" "$aTmpFileISO8859N" "$aTmpNameTmpl" "$aName" "iso8859-9"