如何解决字符编码问题? [英] How do you troubleshoot character encoding problems?

查看:74
本文介绍了如何解决字符编码问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您看到的只是丑陋的无字符框,您使用什么工具或策略找出出了什么问题?

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

(我的具体情况是m面对的是应该在< select>中显示日语字符的无字符框。)

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

推荐答案

首先,丑陋的无字符框可能不是编码问题,它们可能只是您没有安装可在页面上显示字形的字体而已。

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.

将字符串从一个系统传递到另一个系统时,大多数字符编码问题都会发生。对于webapp,通常是在浏览器和应用程序之间,应用程序和文件系统之间以及应用程序和数据库之间。

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.

因此,您需要检查错误的地方-编码的数据来自何处,它在源上具有什么字符编码,以及以什么编码接收。最好的方法是发送已知系统存在问题的字符,并在应用程序的每个级别进行检查。它们在应用程序内部看起来是什么样的?在数据库中?当您从数据库取回它们时?当在浏览器中显示它们时?

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?

很抱歉,如此笼统,但问题并没有解决。

Sorry to be so general, but the question doesn't give much more to work with.

这篇关于如何解决字符编码问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆