Failing to save diacritic text into database. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Failing to save diacritic text into database.

Hello. I want to ask you, if you can help me with my problem. I have a database with one table with two columns (primary int "id" and varchar "data") and I save text submitted on my webpage into it. It works nicely, but I can't save certain words into it. This is a big problem, because I need this for my school class and they want it to work in my native language (Czech). My language has these special characters: á, é, ě, í, ó, ú, ů, ý, č, ď, ň, ř, š, ť, ž. When I submit e.g. word "Žena" (woman in English), it saves just empty string. If I submit Pošta (post), it saves "Po". If I echo the query I want to execute, it outputs the word correctly. If I execute the same query directly in php admin interface, it saves the word correctly as well. Error is somewhere in comunications. Strange thing is, that it automaticaly converts some of those letters into some codes and then it outputs it back into the page correctly. Is there any method that converts all the other letters into these codes? Thanks for any reply.

22nd Jul 2018, 3:05 PM
Jan Štěch
Jan Štěch - avatar
5 Answers
+ 3
Jan Štěch I found this discussion link on SO, hope it could come of use somehow, look at the top answer, it comes with details and links to even more resources. https://stackoverflow.com/questions/279170/utf-8-all-the-way-through P.S. Never mind if you already read it, or if it didn't help. Hth, cmiiw
22nd Jul 2018, 5:39 PM
Ipang
+ 2
Jan Štěch Alright, hope it works out, I also thank you, I learned something again from searching for a solution to this, best of luck on that project : )
22nd Jul 2018, 6:02 PM
Ipang
+ 1
Fopen codes that "ř" and "č" gets converted to looks like this: &#269. But I need to know if there is any method that will convert special characters in a string into these symbols automaticaly. Ipang Thanks a lot. I seems to work so far.
22nd Jul 2018, 5:52 PM
Jan Štěch
Jan Štěch - avatar
0
use special characters á
22nd Jul 2018, 5:49 PM
Fopen
Fopen - avatar
0
give me the answer
23rd Jul 2018, 6:43 AM
divya v
divya v - avatar