Note that there are some explanatory texts on larger screens.

plurals
  1. POmySQL Incorrect Encoding
    text
    copied!<p>o I made a post about removing duplicates from a text file the other night. I got some great help and I just figured out my java parser is removing duplicates correctly. I tried loading the file into mysql database and its still saying there are duplicates. (Along with the error message, it prints out the first text field that appears twice.) So I looked this text up in the output file to see if there was indeed a duplicate there. There wasn't however the same name appears twice, but the only different is:</p> <p>Aguilar, Hernan</p> <p>Aguilar, Hernán</p> <p>The a has a dash above it. This is the error message:</p> <p>ERROR 1062 (23000): Duplicate entry 'Aguilar, Hernán' for key 'PRIMARY'</p> <p>I think even though the names are different, when I use mysql running on linux to load the tables, it reads it as duplicates. This is looking like a problem with encoding. The java parser I'm running on windows, because we had a similar problem with running the program on linux and all the text it printed was incorrect. (It was messing up characters.) On windows it ran fine and the names printed out correctly. This file I'm parsing has foreign movies, so there are many strange characters in it. I have no idea how to fix something like this. The text file is 100% correct, I just need to know how to load it into a mysql table without the encoding getting messed up in the process. The current command I use it:</p> <pre><code>LOAD DATA INFILE 'filename' INTO TABLE tableName FIELDS TERMINATED BY '\t'; </code></pre> <p>I've created many other tables using this command, but those didnt contain duplicates or names like the above in the first place. I've read a few posts suggesting how to fix this, but I am very new to mysql. I have no idea when or where to input what they mentioned or how to check the current encoding scheme. </p> <p>This was the post I read:</p> <blockquote> <p>It does not work because you got this broken during data fetch and you are setting display encoding - it's already too late. Simply ensure correct encoding during connection by using either using proper method like mysqli_set_charset() or do query SET NAMES UTF8 just after your connect to DB.</p> </blockquote> <p>The person was not talking about loading a table though, but running queries. Im not sure if something like this would work. This is for a school project, so we were given a database to work with. I'm not even sure whether I will have permission to change encoding or not.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload