Forum Discussion

ashilkin_177320's avatar
Icon for Nimbostratus rankNimbostratus
Aug 20, 2015

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:


But in second case same string:


Someone has an idea?

Thank you!

3 Replies

  • 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 -

    • Ping_Xiong_1567's avatar
      Historic F5 Account

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