0

In my Android app, user types in some text that is then sent to a database (by using a URL with php). All is working fine, except that only some of the special caracters are saved in the relevant field.

For example, user has put in

čćáæíœ

and in the database I find the following:

??áæí?

The first 2 caracters and the last one have been translated to '?'

The field is utf8_general_ci. The fact that some caracters work and others not, leaves me clueless.

michaelsmith
  • 1,011
  • 1
  • 16
  • 35
  • Thank you for the status report on your current development efforts. Did you have a question? – spencer7593 Jan 05 '15 at 20:11
  • ?? Question is: How can it be possible that some special caracters are stored in mysql correctly, and others are translated into '?' – michaelsmith Jan 05 '15 at 20:13
  • possible duplicate of [UTF-8 all the way through](http://stackoverflow.com/questions/279170/utf-8-all-the-way-through) – Marcus Adams Jan 05 '15 at 20:17

1 Answers1

0

There's a characterset translation going on. And that question mark is the default character which is assigned when the characterset translation results in an undefined character.

Notice something here:

č  U+010D
ć  U+0107
á  U+00E1
æ  U+00E6
í  U+00ED
œ  U+0153

All of those characters that are being translated to question marks have something in common which is different from the characters that are not.

Here are some references as a starting point:

The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) http://www.joelonsoftware.com/articles/Unicode.html

What Every Programmer Absolutely, Positively Needs To Know About Encodings And Character Sets To Work With Text http://kunststube.net/encoding/

http://en.wikipedia.org/wiki/UTF-8


With those under your belt, hopefully the documentation will make more sense:

http://developer.android.com/reference/java/nio/charset/Charset.html

spencer7593
  • 106,611
  • 15
  • 112
  • 140