This page describes how to convert a string to or from the GSM 03.38 character set. '''Requirements''' * The gsm0338 encoding must be available in the Tcl installation. Download it from http://search.cpan.org/src/JHI/perl-5.7.2/ext/Encode/Encode/ and save it as e.g. $tcl_library/encoding/gsm0338.enc * A TCL-Version which supports [encoding convertto] and [encoding convertfrom] (Tcl 8.1 or above) '''The non-null 0 character "@"''' In the GSM 03.38 character set, the character "@" is encoded as 0x00. [encoding convertto] interprets such characters as "not convertible" and uses the fallback character "?". Example: set gsmString [encoding convertto gsm0338 "me@domain.com"] # will return me?domain.com instead of me\x00domain.com '''Workarounds''' # The string is split at each "@", and the pieces are converted # separately. proc toGsm {aString} { set partsWithoutAt [split $aString "@"] set convertedPartsWithoutAt {} foreach part $partsWithoutAt { lappend convertedPartsWithoutAt [encoding convertto gsm0338 $part] } return [join $convertedPartsWithoutAt "\x00"] } An alternative workaround, which is shorter but relies on an implementation detail of [encoding convertto]: proc toGsm {aString} { return [encoding convertto gsm0338 [string map {@ \x00} $aString] ] }