Forum Discussion
ingard
Nimbostratus
Oct 20, 2008encoding query text from utf-8 to iso8859-1 (latin1)
Hi
I have a situation where i do some redirects to other partner websites based on hostname in an irule. To these websites I also pass a query string. However, one of the partner sites does not support utf-8 encoding, so I need to encode the query string to latin1/iso8859-1 before passing it to this particular site. I tried with something like this:
.
.
lets try to extract the query
regexp {q=(.+)} $uri -> q
if {[info exists q]} {
set qiso [encoding convertto latin-1 $q]
.
.
which gives me the following error:
TCL error: irule_abcsok_rewrites_1881 HTTP_REQUEST - invalid command name encoding while executing encoding convertto latin-1 $q
Any ideas?
regards
ingard
3 Replies
- hoolio
Cirrostratus
Hi ingard,
'encoding' is one of the disabled TCL commands:
http://devcentral.f5.com/wiki/default.aspx/iRules/DisabledTclCommands.html
To get a list of commands you can use the following rule:when RULE_INIT { foreach cmd [lsort [info commands]] { log local0. " cmd: $cmd" } }
I'm not sure what the best way to convert UTF-8 to ISO-8859-1 without the encoding command would be. Here is a related post without much of an iRule-based solution (Click here).
Anyone have ideas?
Aaron - ingard
Nimbostratus
Doh! whats the reason for disabling the encoding command? Would it be possible to enable it from the shell? If I can't make this work it would mean i'd have to send the requests to the webservers (again) - which would suck.. - hoolio
Cirrostratus
I'm not sure why it's disabled. Maybe a developer could explain the logic. Or you could open a case with F5 Support to find out why and ask for it to be supported in a future version.
I don't think there is a simple way to enable the command if it was explicitly disabled by F5.
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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