开发者

utf-8 latin1 problem charset collation

开发者 https://www.devze.com 2023-01-30 22:36 出处:网络
If I am sending utf-8 data to a mysql db which has a charset of utf-8 but a collation of latin1 wo开发者_如何学JAVAuld that be a problem? and why?

If I am sending utf-8 data to a mysql db which has a charset of utf-8 but a collation of latin1 wo开发者_如何学JAVAuld that be a problem? and why?

what does the collation do in this case?

I am getting mangled up data when I extract it from the db, will a collation change fix that?

Update

The mangled data in the DB is for example like this:

 Töst

It should be like:

Täst  

correct?


About your error: make sure you send SET NAMES utf8 to your SQL server before INSERTing the data.


It wouldn't be a problem, per-se. The collation controls things like sort order & how comparisons are accomplished.

It is likely that the mangled data is being caused by something else.


Collation relates to how different characters will be compared. This could cause issues if you are comparing utf-8 data with a latin1 collation since you may get different results than what you expect. Changing the collation will not stop the data from being mangled.

0

精彩评论

暂无评论...
验证码 换一张
取 消