Search code examples
character-encodingspecial-characterscharacter

Bad characters from CSV into database


I am trying to figure out why I keep getting bad characters when I import information into my database from a CSV file.

Setup:

Database is UTF-8 encoding HTML Page = UTF-8 Encoding (Meta Tag)

What I'm receiving when the file is imported is. alt text

But in the CSV file everything looks clean, and the actual number is +1 (250) 862-8350

So I don't know what the issue is, my hunch is something to do with a form of trimming but I haven't been able to figure out what it is... any light would be appreciated!


Solution

  • Well I found out my answer, and it's somewhat embarasing. when my phone number gets put into the database I run it through my cleaner, and then encode the data... But I didn't notice that my database column was set to a small character count... and my encoding was longer that what would be inserted into the database... So in short, I made a my column 64 vs 32 and it solved the problem.

    Thank you for your time in trying to help me though!