<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Encoding on Lin's Blog</title><link>https://coder.tw/en/tags/encoding/</link><description>Recent content in Encoding on Lin's Blog</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Fri, 04 Feb 2011 12:24:55 +0000</lastBuildDate><atom:link href="https://coder.tw/en/tags/encoding/index.xml" rel="self" type="application/rss+xml"/><item><title>[PHP] mb_convert_encoding: Some API Returned the Wrong Encoding? Convert It!</title><link>https://coder.tw/en/posts/php-mb-convert-encoding-big5-utf8-gbk/</link><pubDate>Fri, 04 Feb 2011 12:24:55 +0000</pubDate><guid>https://coder.tw/en/posts/php-mb-convert-encoding-big5-utf8-gbk/</guid><description>&lt;p&gt;&lt;a href="https://pub-6c026d2742d14927bfa2d850c31eac91.r2.dev/wp-content/uploads/2011/02/2011-02-04_123628.jpg"&gt;&lt;img class="alignnone size-large wp-image-4662" title="2011-02-04_123628" src="https://pub-6c026d2742d14927bfa2d850c31eac91.r2.dev/wp-content/uploads/2011/02/2011-02-04_123628-520x303.jpg" alt="" width="520" height="303" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;↑↑This is viewed in Chrome with Big5 encoding. The top is before conversion, and the bottom is after conversion.&lt;/p&gt;
&lt;p&gt;Yesterday, while playing with the Google Weather API, I found that it has a parameter for setting your language. If you don&amp;rsquo;t set it, the API returns English in UTF-8 encoding. But if you set zh-TW, it returns Chinese, encoded in Big5. So when using this API, I had to re-encode its return value to UTF-8 before I could use it. After all, there aren&amp;rsquo;t many Big5 websites left, so yesterday I went looking for the mb_convert_encoding function to do the encoding conversion for me~&lt;/p&gt;</description></item></channel></rss>