How to make IE post FORM data in UTF-8?

前端 未结 1 637
粉色の甜心
粉色の甜心 2021-02-10 07:52

This is continuation of this question: Java Jersey: Receive form parameter as byte array

I need form data to be posted in UTF-8 even if containing page uses ISO-8859-1 c

相关标签:
1条回答
  • 2021-02-10 08:04

    Ruby on rails applications use this trick: they add in an hidden field an UTF-8 character that cannot be coerced into ISO Latin 1.

    The field they use is

    <input name="utf8" type="hidden" value="&#x2713;" />
    

    and it ends up in the query parameters as

    search?param1=foo&param2=bar&utf8=✓
    

    History note: before utf8=✓, Ruby on rails used a fancy snowman to force UTF-8: http://intertwingly.net/blog/2010/07/29/Rails-and-Snowmen.

    0 讨论(0)
提交回复
热议问题