Forum Discussion
Joel_Moses
Nimbostratus
Feb 04, 2010Convert unicode to ascii?
Anyone know a simple way to convert a unicode string to ASCII within an iRule?
I was hoping that [encoding convertfrom unicode $item] from the TCL world would work, but this doesn't seem to be available for use in iRules.
In order to be usable in the new 10.1 tables feature, I need to convert a unicode field to ASCII so I can use it as a subtable name.
- Joel_Moses
Nimbostratus
So without [encoding convertfrom unicode $variable], the following will do the job:foreach i [ split $variable ""] { scan $i %c c if {$c>1} { append variable_convert $i } elseif {$c<128} { set variable_convert $ntlm_host_convert } else { append variable_convert \\u[format %04.4X $c] } } set variable $variable_convert
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects