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 see...
Joel_Moses
Nimbostratus
Feb 05, 2010So 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
This is really kind of a hack, but it works most of the time. If anyone from PD is reading this, please please please unblock the [encoding] command for iRule use (at least the convertto and convertfrom one)!!
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