Forum Discussion
EBCDIC to ASCII conversion
Hello!
I am trying to convert a string from EBCDIC to ASCII however I have found out the hard way that the encoding function is not available in TCL / iRules on F5. I have been researching how to possibly achieve this in an alternate way however I have hit a blank. Anyone got any ideas how I can achieve this? I am running 13.1.1.5.
Thanks James!
- Leonardo_Souza
Cirrocumulus
The enconding command exists in the tcl version used in F5 but is not available via iRules as you pointed out.
[root@LABBIGIP1:Active:Changes Pending] images # tclsh % encoding convertto ebcdic "EXAMPLE" ÅçÁÔ×ÓÅ
When I try via iRules:
when HTTP_REQUEST { log local0. [encoding convertto ebcdic "EXAMPLE"] } Nov 11 17:51:20 LABBIGIP1 err tmm2[22248]: 01220001:3: TCL error: /Common/test1 <HTTP_REQUEST> - invalid command name "encoding" while executing "encoding convertto ebcdic "EXAMPLE""
One possible solution is to try to build the conversion yourself, using string map:
when HTTP_REQUEST { log local0. [string map [list "Å" "b"] "Åbc"] } Nov 11 18:19:04 LABBIGIP1 info tmm5[22248]: Rule /Common/test1 <HTTP_REQUEST>: bbc
If you can't do the mapping this way, you will have to look mapping using hex or binary.
- beefy80
Nimbostratus
Leonardo
Thank you for the reply. Your suggestion of using a string map is something I thought about but was hoping there maybe a better way. I did read somewhere that iRulesLX can do it but I'll be honest to say that I would not know where to start with that.
James
- Leonardo_Souza
Cirrocumulus
Sorry for the delay...
I haven't play whit iRulesLX yet, but I understand the basics of it.
With iRulesLX you have access to any Nodejs package available, so I just did a quick google search:
https://www.npmjs.com/package/nm-ebcdic-converter
To get started with iRule LX:
https://clouddocs.f5.com/training/community/irules/html/class3/class3.html
Good luck :P
- Darin_DeFer
Altostratus
I have the same issue. I've tried the string list / string map approach both with a list declaration AND programatically and I can't get past the LTM validation.
The declaration approach and code approach both work fine in a local TCL shell, but blow up the LTM validation step.
Get this: the string list declaration version even blows up the validation step WHEN IT'S COMMENTED OUT.
Error is always the same, regardless of declaration or programmatic version:
01070151:3: Rule [/Common/ISO8583-EXTRACT] error: /Common/ISO8583-EXTRACT:75: error: [braces are required around the expression][proc getEbcdicMap {} {
Surely someone has gotten past this before. But HOW?
Recent Discussions
Related Content
* 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