0

I have an issue inserting a pdf text into a mysql table. The error message is as follows: " Incorrect string value: '\xF0\x9D\x9B\xBC i...' for column 'text' at row 1"

I know that this code refers to the greek letter alpha. However, I have set 'characer set' to UTF-8 for the column text but also in the mysql connection. Also, I have tried uft8mb4. However, none of it worked.

The greek letter alpha occurs in different font types. I am not sure if this matters.

Any ideas why this does not work?

I also created a pdf file myself which contained an alpha in the text. For this example, my programme runs without any errors. Although I know that the error message refers to the alpha, there seems to be an additional issue.

Thanks in advance!

UPDATE: After some checking, I found that some really strange symbols were created from a formula which contained the greek letter alpha. So, apparently these unknown symbols led to the error. However, I still do not know how to exclude any unknown symbols from the text. What is the easiest way to do this?

These are the symbols: unknown symbols

6
  • use the MySQL BLOB datatypes Commented Sep 7, 2017 at 12:28
  • and make sure you connnect with the utf8 charset.. stackoverflow.com/questions/3275524/java-mysql-utf8-problem Commented Sep 7, 2017 at 12:35
  • i do not get an error anymore. however, it looks like there is no text data in this blob-type table record. I also tried to convert it using SELECT CONVERT(text USING utf8) FROM table; but there seems to be no information stored in this record. (it is a null entry) Commented Sep 7, 2017 at 12:48
  • please see my update in my original post. shouldn't the blob type take care of any kind of unknown symbols? unfortunately, this did not work for me. Commented Sep 7, 2017 at 14:18
  • A PDF is binary data, incompatible with UTF-8. stackoverflow.com/questions/10729824/… Commented Sep 7, 2017 at 14:33

2 Answers 2

0

I restricted the string in Java to only latin symbols. maybe that's not the most general way of getting rid of those strange symbols but it works for now.

Sign up to request clarification or add additional context in comments.

Comments

0

In MySQL, use CHARACTER SET utf8mb4.

Add ?useUnicode=yes&characterEncoding=UTF-8 to the JDBC URL

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.