Fix garbled message text: Difference between revisions
Jump to navigation
Jump to search
| Line 7: | Line 7: | ||
Possible approaches to encode the message text: | |||
<table border="1" style="width: 100%; table-layout: fixed;"> | <table border="1" style="width: 100%; table-layout: fixed;"> | ||
<tr> | <tr> | ||
| Line 26: | Line 27: | ||
</td> | </td> | ||
<td style="word-wrap: break-word;"> <ul><li>before: <nowiki>http://www.中文網址.tw/my test.asp?name=ståle&car=saab</nowiki> <li>after: <nowiki>http%3A%2F%2Fwww.%E4%B8%AD%E6%96%87%E7%B6%B2%E5%9D%80.tw%2Fmy%20test.asp%3Fname%3Dst%C3%A5le%26car%3Dsaab</nowiki> </ul> | <td style="word-wrap: break-word;"> <ul><li>before: <nowiki>http://www.中文網址.tw/my test.asp?name=ståle&car=saab</nowiki> <li>after: <nowiki>http%3A%2F%2Fwww.%E4%B8%AD%E6%96%87%E7%B6%B2%E5%9D%80.tw%2Fmy%20test.asp%3Fname%3Dst%C3%A5le%26car%3Dsaab</nowiki> </ul> | ||
</td> | </td> | ||
</tr> | </tr> | ||
| Line 40: | Line 40: | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<th> [http://php.net/serialize PHP: serialize | <th> [http://php.net/manual/en/function.json-encode.php PHP: json_encode] | ||
</th> | |||
<td>Save array in mysql database | |||
</td> | |||
<td> TRUE | |||
</td> | |||
<td style="word-wrap: break-word;"> <ul><li>before: array("作者" => "馬克吐溫"); <li>after: <nowiki>{"\u4f5c\u8005":"\u99ac\u514b\u5410\u6eab"}</nowiki></ul> | |||
</td> | |||
</tr> | |||
<tr> | |||
<th> [http://php.net/serialize PHP: serialize] | |||
</th> | </th> | ||
<td>[http://stackoverflow.com/questions/10686333/save-array-in-mysql-database Save array in mysql database] | <td>[http://stackoverflow.com/questions/10686333/save-array-in-mysql-database Save array in mysql database] | ||
</td> | </td> | ||
<td> FALSE | <td> <span style="color: #999">FALSE</span> | ||
</td> | </td> | ||
<td style="word-wrap: break-word;"> <ul><li>before: array("作者" => "馬克吐溫"); <li>after: a:1:{s:6:"作者";s:12:"馬克吐溫";}</ul> | <td style="word-wrap: break-word;"> <ul><li>before: array("作者" => "馬克吐溫"); <li>after: a:1:{s:6:"作者";s:12:"馬克吐溫";}</ul> | ||
Revision as of 14:12, 5 August 2016
Ideas on how to fix garbled message text
- Possible cause
- Encoding issue: Choose the correct the language/encode of message text or auto detect the encode by tools
- PHP utf8_encode() & utf8_decode()
- (optional) convert the current encode to UTF-8
- (optional) Making text wrap to window size
Possible approaches to encode the message text:
| Approach | Goal | Is Chinese text garbled/encoded? | Sample text |
|---|---|---|---|
| JavaScript decodeURIComponent() Function[1] | "converts characters into a format that can be transmitted over the Internet ... " Cited from w3schools | TRUE |
|
| URL Decoder/Encoder[2] | (same as above) | TRUE | (same as above) |
| PHP: json_encode | Save array in mysql database | TRUE |
|
| PHP: serialize | Save array in mysql database | FALSE |
|
Ways to fix garbled message text
ConvertZ v.8.02
- choose encode: manually (mainly in Asia language)
- convert to UTF-8: available
- convert to big5 from UTF-8: available
the wording may be changed by the software ex: 余美人 -> 於美人 - allow to wrap long text: available
EmEditor v.14.3.1 ($)
- choose encode: manually and auto-detect

- convert to UTF-8: available
- allow to wrap long text: available
- support command line: EmEditor FAQ: How can I convert file encodings with the command line?
Google Chrome v.10 (viewer)
- choose encode: manually and auto-detect
- allow to wrap long text: available (auto)

MadEdit v.0.2.9.1
- choose encode: manually and auto-detect

- convert to UTF-8: available
- allow to wrap long text: available
Microsoft Internet Explorer v.8 (viewer)
- choose encode: manually and auto-detect
- allow to wrap long text:
Microsoft notepad (記事本) for Windows
method 1: Err: 解決用記事本(notepad)開啟簡體字txt檔,出現亂碼的問題(2010): notepad + Notepad++
- choose encode: manually
- convert to UTF-8: available by Notepad++
- allow to wrap long text: available
method 2: Microsoft AppLocale 公用程式(patched: piaip pAppLocale) + notepad
- choose encode: manually
- convert to UTF-8: not available
- allow to wrap long text: available
Microsoft Office Word 2003 ($)
- choose encode: manually
- convert to UTF-8: available
- allow to wrap long text: available
Mozilla Firefox v.3.6 (viewer)
- choose encode: manually and auto-detect
- allow to wrap long text: no but you can copy the following code into the web address bar to wrap long text (Thanks, Return of the Sasquatch: word wrap for Firefox bookmarklet!)
javascript:(function() { var D = document; F(D.body); function F(n) { var u, r, c, x; if (n.nodeType == 3) { u = n.data.search(/\S{45}/); if (u >= 0) { r = n.splitText(u + 45); n.parentNode.insertBefore(D.createElement('wbr'), r); } } else if ((n.tagName != 'STYLE') && (n.tagName != 'SCRIPT')) { for (c = 0; x = n.childNodes[c]; ++c) { F(x); } } } D.body.innerHTML += ' '; })();
Notepad++ v.5.8
- choose encode: manually
- convert to UTF-8: available
- allow to wrap long text: available
not supported at this moment
- LibreOffice 3.3.0 - Writer
- OpenOffice.org 3.3.0 - Writer is not supported but OpenOffice.org Calc is supported.