AdirZe
Feb 01, 2023Altocumulus
Using string map or regsub breaks non-english (UTF-8) characters
Hi Dear community ,
I woud appreciate your input. I want to replace a string inside a HTTP::payload with string map or regsub and then HTTP::payload replace. The replacement does take place but it also break the non-english [UTF-8] characters inside the HTML.
I tried implementing all the soultions I found inside DevCentral. Including these:
https://support.f5.com/csp/article/K22406348
https://clouddocs.f5.com/api/irules/HTTP__payload.html
- Note that the argument will be interpreted as a byte array. If it is actually a UTF-8 string with multibyte characters, the output will not be what you expect. In order to prepare a UTF-8 string for use as input to HTTP::payload replace, you should first run ‘binary scan c* throwawayvariable’.
Btw, Stream profile does work fine , but it's not very compatible with APM Virtual Servers.
Best Regards,
Adir
Can you try adding
binary scan $new_data @0
in the HTTP_RESPONSE_DATA event handler? I think that's the missing piece per https://support.f5.com/csp/article/K22406348.