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

Binary format in tcl 8.4

Status
Not open for further replies.

ArchanaSK

Programmer
Oct 30, 2014
1
IN
Hi,

I'm trying to convert Arabic to hex using binary format and binary scan. But the format seems to be not working correctly. Below is the code snippet for reference.

set message {قد تم تشغيل خدمةCLIP التي اشتركت بها. }
puts "String before : $message"
set mess [ConstructArabicMessage $message]
puts $mess

proc ConstructArabicMessage {message} {
.
.
.
.
set formatA(m_length) c
set formatA(short_message) a*
set m_length [string length $message]
set SubmitMessageBody_Rest ""

foreach pField {m_length short_message} {
set bin [binary format $formatA($pField) [subst \$$pField]]
append SubmitMessageBody_Rest $bin
binary scan $bin H* decode
puts $decode
}
.
.
.
.
}

Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top