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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

format command and unicode

Status
Not open for further replies.

tallhunter

IS-IT--Management
Aug 13, 2003
1
GB
Hi,

I am trying to translate text strings into the PC's local language from english.

The mechanism works fine for straight string conversion using msgcat::mc, it correctly translates and converts the unicode to relevant characters.

However if I try to substitute strings using the format command with %s there is a problem. The problem is the characters are still encoded as unicode (e.g.\u00f6)

Can anyone point out the problem?

code snip:
if {[info exists ::msgcat::msgs($loc,$ns,$src)]} {
set temp $::msgcat::msgs($loc,$ns,$src)
if {[llength $args] == 0} {
return $::msgcat::msgs($loc,$ns,$src)
} else {
return [eval \
[list format $::msgcat::msgs($loc,$ns,$src)] \
$args]
}
}

Thanks
Paul
 
The args argument is passed as a list.
Try:
Code:
  eval [linsert $args 0 format [list $::msgcat::msgs($loc,$ns,$src)]]
(not tested)
You're in the Quoting Hell: you need to build a command from a list ($args) and a string ($::msg...) that can contain spaces so can be considered (by list commands) as a list.

I hate the Quoting Hell.

HTH

ulis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top