Browser's Encoding
Author
Zhou Renjian
Create@
2004-12-26 21:31
In IE, when I output using:
response.setContentType("text/html;charset=gb2312");
response.setCharacterEncoding("gb2312");
IE will treat the page as "GB2312"-encoding, even though the HTML page's header is
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
But in Mozilla 1.7.5, it will be treated as "UTF-8" encoded, and after search the query, all Chinese characters are treated as UTF-8 encoding, and consequencely with wrong result. If I manually set the page's encoding to "GB2312", the search will be OK.
Maybe I have to do more on XHTML pages' codes.