"渣打 \ 351 \ 223 \ 266" CGI::unescapeHTML("渣û...">

Problem with CGI :: unescapeHTML

CGI::unescapeHTML("渣打银")

=> "渣打 \ 351 \ 223 \ 266"

CGI::unescapeHTML("渣打银 ")

=> "渣打 ι“Ά"

Adding a space to the end makes a difference, otherwise the last character is lost, and I get this strange sequence of characters. I ran into this problem when I try to clear data websites using utf-8 character encoding. This is true even for plain English text.

+3
source share
2 answers

This is not a problem with the library CGIthat ships with Ruby 1.9.2 and higher.

+1
source

Run ruby ​​interpreter with -Ku

0
source

Source: https://habr.com/ru/post/1774239/


All Articles