{"id":150,"date":"2007-03-12T02:13:00","date_gmt":"2007-03-12T07:13:00","guid":{"rendered":"http:\/\/wangxiaohu.com\/blog\/?p=150"},"modified":"2007-03-12T02:13:00","modified_gmt":"2007-03-12T07:13:00","slug":"quick-and-dirty","status":"publish","type":"post","link":"https:\/\/wangxiaohu.com\/blog\/?p=150","title":{"rendered":"Quick and Dirty"},"content":{"rendered":"<p>How do you solve the problem that a single page cannot display two sets of information in different character encodings under IE? I had this problem in\u00a0the <a href=\"http:\/\/wangxiaohu.com\/index.php\/2006\/08\/10\/%e5%b0%8f%e8%99%8e%e7%89%88wordpress%e6%8f%92%e4%bb%b6%e4%b8%a4%e4%b8%aa\/\">counterize plugin<\/a> for WordPress, since the default page is in UTF-8 but the IP location information retrieved from somewhere else is in GB2312. So everytime I have to switch back and forth in IE -&gt; View -&gt; Encoding. Apparently Firefox does not have this problem. I don&#8217;t know how does it detects the GB2312 text and displays it correctly. But I do have a work around for this.<\/p>\n<p>It is fairly simple. Create a separete page with its default encoding set to GB2312 and retrieves whatever information in GB2312 it wants. Then in the UTF-8 page that used to be problematic, replace the original\u00a0script calls with iframe calls to the new GB2312 page. That&#8217;s it!<\/p>\n<p><strong>Example:<\/strong> Replace something like<\/p>\n<blockquote>\n<p><font face=\"Courier New\" color=\"#333333\">&lt;script src=&#8221;a.php?some=parameters&#8221;&gt;&lt;\/script&gt;<\/font><\/p>\n<\/blockquote>\n<p>with something like<\/p>\n<blockquote>\n<p><font face=\"Courier New\" color=\"#333333\">&lt;iframe src=&#8221;b.php?some=parameters&#8221;&gt;&lt;\/iframe&gt;<\/font><\/p>\n<\/blockquote>\n<p>where in <font face=\"Courier New\">b.php<\/font> it passes <font face=\"Courier New\">some=parameters<\/font> to <font face=\"Courier New\">a.php<\/font> directly by using the <font face=\"Courier New\">script<\/font> tag.<\/p>\n<p>One more advantage is that when browser creates iframe objects, it creates\u00a0a separate\u00a0thread for loading the framed page. It\u00a0allows\u00a0constant information in the UTF-8 page to be displayed first\u00a0while GB2312 page is loading, instead of waiting long for the\u00a0GB2312\u00a0text to be retrieved and the displays the rest of the main page.<\/p>\n<p>It is quick and dirty, but as long as it works, I&#8217;m fine with it. Remember to set the iframe to be borderless and transparent.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How do you solve the problem that a single page cannot  &hellip; <a href=\"https:\/\/wangxiaohu.com\/blog\/?p=150\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">Quick and Dirty<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_jetpack_memberships_contains_paid_content":false},"categories":[1],"tags":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","jetpack_likes_enabled":true,"jetpack-related-posts":[],"jetpack_shortlink":"https:\/\/wp.me\/pdhZ2A-2q","_links":{"self":[{"href":"https:\/\/wangxiaohu.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/150"}],"collection":[{"href":"https:\/\/wangxiaohu.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wangxiaohu.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wangxiaohu.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/wangxiaohu.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=150"}],"version-history":[{"count":0,"href":"https:\/\/wangxiaohu.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/150\/revisions"}],"wp:attachment":[{"href":"https:\/\/wangxiaohu.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=150"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wangxiaohu.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=150"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wangxiaohu.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=150"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}