<p>If all you see is the ugly no-char boxes, what tools or strategies do you use to figure out what went wrong?</p>

<p>(The specific scenario I'm facing is no-char boxes within a &lt;select&gt; when it should be showing Japanese chars.)</p>

[{'answer_id': 29515, 'author': 'Charles Miller', 'author_id': 3052, 'author_profile': 'https://Stackoverflow.com/users/3052', 'pm_score': 3, 'selected': True, 'text': '<p>Firstly, "ugly no-char boxes" might not be an encoding problem, they might just be a sign you don\'t have a font installed that can display the glyphs in the page.</p>\n\n<p>Most character encoding problems happen when strings are being passed from one system to another. For webapps, this is usually between the browser and the application, between the application and the filesystem and between the application and the database.</p>\n\n<p>So you need to check where the mis-encoded data is coming from, what character encoding it has at the source, and what encoding it is being received as. The best way is to send through characters you know the system is having problems with, and examine them at each level of the app. What do they look like inside the app? In the database? When you get them back from the database? When they\'re displayed in the browser?</p>\n\n<p>Sorry to be so general, but the question doesn\'t give much more to work with.</p>\n'}, {'answer_id': 29641, 'author': 'David Sykes', 'author_id': 259, 'author_profile': 'https://Stackoverflow.com/users/259', 'pm_score': 1, 'selected': False, 'text': '<p>Redirect the data to disk and use a <a href="https://www.hhdsoftware.com/free-hex-editor" rel="nofollow noreferrer">Hex Editor</a>. Most text editors / viewers do their own conversions behind the scenes, so it is difficult to be sure you are seeing the data in it\'s true form.</p>\n'}, {'answer_id': 60308, 'author': 'pchap10k', 'author_id': 6230, 'author_profile': 'https://Stackoverflow.com/users/6230', 'pm_score': 2, 'selected': False, 'text': '<p>If the data you send to the browser becomes mangled (moji-bake) you will get trash characters. Also, if you specify the wrong character set in your META headers, your browser will render the page incorrectly, causing moji-bake again, sometimes in random places on the page.</p>\n\n<p>When handling CJK character sets, you must be sure to use UTF8 character encoding throughout the lifetime of your program (data storage, retrieval, data manipulation in your code, displaying in the browsser etc...)</p>\n\n<p><strong>What is UTF8?</strong>\nUTF8 handles binary streams of data, not strings. This means the bit combinations can have variable length. ASCII characters have a fixed length of 8 bits representing 1 byte, however UTF8 characters can be composed of 6bits, 8bits, 12bits, etc... As such, UTF8 is prone to what Japanese call "mojibake".</p>\n\n<p>As a coder, from database to codebase to browser, you should try and use UTF8 completely. For email you can use UTF8, but you will probably find most mail servers and clients are still old and use a mishmash of different character sets (e.g. ISO9022X).</p>\n\n<p><strong>Database Settings</strong>\nIf you are a mysql user, then make sure you have to ensure all connections to the DB use UTF8, and that all tables/fields use UTF8. By default mysql uses Latin (Swedish) character sets. Those kooky swedes love their sense of humour!!</p>\n\n<p><strong>Checking your Codebase</strong>\nIn my experience editors like Notepad++, Notepad2, UltraEdit, e, etc... all have UTF8 support problems. They mostly work, but since their developers don\'t use CJK languages themselves, they are not perfected. Issues like turning off BOM (Byte Order Mark), mangled tabs, poor character set conversion, etc ... all present problems.</p>\n\n<p>I highly recommend using a proven UTF8 editor like Maruo. This is made by a Japanese company, but there is an English version (and a trial version) at <a href="http://www.hidemaru.interlink.or.jp/software/" rel="nofollow noreferrer">http://www.hidemaru.interlink.or.jp/software/</a></p>\n\n<p>Lastly, you may need to convert your source files into UTF8. Especially if the codebase itself has CJK language strings contained therein.</p>\n\n<p><strong>Manipulating Strings</strong>\nAny string function need to multibyte safe. Notice I didn\'t say double-byte. UTF8 is not a double byte but multibyte, depending on the total number of bits used to represent a character. In PHP you need to call the MB string functions specifically. Ruby and other languages have more transparent support, but you need to check the docs for your flavour of application server!</p>\n\n<p><strong>META Tags</strong>\nCheck out google.co.jp or yahoo.co.jp for their META headers. These are sites that know how to to it properly. Basically include the following META tag the doucment &lt;HEAD&gt;</p>\n\n<p>&lt;meta http-equiv="content-type" content="text/html; charset=utf-8"&gt;</p>\n\n<p>It is usually safe to mix English HTML document type attributes with the above character too. So adding the META tag above seems to work in a HTML document that has:</p>\n\n<p>&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;</p>\n\n<p><strong>Email</strong>\nThis is a wholly different can of worms. UTF8 works a lot, but many older Japanese clients use ISO2022X more. This is not worth covering here.</p>\n\n<p><strong>Debugging UTF8 Issues</strong>\nOnce you have a reliable UTF8 editor like Maruo, you can create static pages and resolve your issues.</p>\n\n<p><em>Hope that helps</em></p>\n'}]
['https://Stackoverflow.com/questions/29499', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/337/']