Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Clear all filters
Answers

Web page in iFile over HTTP::respond content

Hi all! I have a strange situation. I have a html page in iFile storage. The page has cyrillic text and I return this page to clients by HTTP::respond content in iRule. If I use construction like:

HTTP::respond 200  content [ifile get web_page] "Content-Type" "text/html;charset=utf-8"

I have right result and my cyrillic text displayed correct. But if I want to process variables and use constructions like:

set web_page [subst -nobackslashes [ifile get web_page]]
...
HTTP::respond 200 content $web_page "Content-Type" "text/html;charset=utf-8"

my variables work correct, but instead cyrillic words I see something like "К сожÐ". I sniff both metod by WireShark and notice that octal codes of chars are difference. For example, in first case I have:

<title>\320\240\320\265\321\201\321\203\321\200\321\201...</title>\r\n

But in second case same string:

 <title>\303\220\302\240\303\220\302\265\303\221\302\201...</title>\r\n

Someone has an idea?

Thank you!

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Did you try charset=windows-1251

-=Deckard=-

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Deckard, Thank you for help, but unfortunately it doesn't work in my case. Thanks for F5 support, they found solution - for my case, I should use following construction for generating binary string rather than UTF-8 encoding:

set web_page [ binary format a* [subst -nobackslashes [ifile get web_page]]]
...
HTTP::respond 200 content $web_page "Content-Type" "text/html;charset=utf-8"

For details - https://www.tcl.tk/man/tcl8.4/TclCmd/binary.htm

0
Comments on this Answer
Comment made 08-Jun-2018 by Ping Xiong

This is really cool, I can handle Chinese characters with the ifile.

0