Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting Unicode characters

Status
Not open for further replies.

bellecombe

Instructor
Joined
Oct 15, 2003
Messages
7
Location
IT
Hi
In my tcl script I have this: [pre]...
append p "B,confirmButton,\u2714,,Exit Ok;"
...[/pre]
that is used for generate a form button with caption the Unicode Lower Right Pencil.
When this is into a file this not appens i.e I am not be able to convert the below alternatives into a
desired caption.
[pre]
B,execButton,✎,,tryForm;
B,execButton,\u270E;[/pre]
The file is coded utf8 without BOM.
tanks
John Rossati
 
1) Do you want utf8 or utf16 type unicode?
2) Are you writing to a file or do you want it displayed in a GUI or a console
3) Are you using Linux or Windows
 
Thanks xwb
The file is coded utf8 without BOM; I am working on Windows and in my application I have both a TCL variable both a file text that contains \u270E and the first case Lower Right Pencil is showed correctly.
For the \u270E in a file I have found an answer i.e.:
[pre]...
if {[file exists $params] == 1} {
set fp [open $params r]
set params [fg_Unicode [read $fp]]
close $fp
}
...
proc fg_Unicode {s} {
set RE {[][{}\u0100-\uffff]}
set substitution {[format \\\\u%04x [scan "\\&" %c]]}
return [subst [regsub -all $RE $s $substitution]]
}[/pre]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top