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.
精彩评论