charset problem when loading data
Moderator: General Moderators
-
orlandinho
- Forum Newbie
- Posts: 18
- Joined: Mon Feb 12, 2007 9:50 pm
charset problem when loading data
hi
i have de following problem:
i have a database in utf8-general_ci charset, i have to fill it with some data from other database
in the other database i have tables with data using characters like Ñ and they stored well in database
when i do select * into outfile ......, it creates a file that´s ok
when i try to load this file in my utf8 database i receive a message: "Data too long for column col1"
on the other hand , i have another pc with ubuntu and mysql, when i do select * into outfile. it creates a file similar to the first
but when i do "load data infile ...." with this file it uploads correct data with no problem
i opened both files and they are similar, how can i resolve this :O
i have de following problem:
i have a database in utf8-general_ci charset, i have to fill it with some data from other database
in the other database i have tables with data using characters like Ñ and they stored well in database
when i do select * into outfile ......, it creates a file that´s ok
when i try to load this file in my utf8 database i receive a message: "Data too long for column col1"
on the other hand , i have another pc with ubuntu and mysql, when i do select * into outfile. it creates a file similar to the first
but when i do "load data infile ...." with this file it uploads correct data with no problem
i opened both files and they are similar, how can i resolve this :O
Re: charset problem when loading data
And the data in this "other" database has what character encoding?orlandinho wrote:i have a database in utf8-general_ci charset, i have to fill it with some data from other database
in the other database i have tables with data using characters like Ñ and they stored well in database
instead runorlandinho wrote:when i do select * into outfile ......, it creates a file that´s ok
Code: Select all
SHOW FULL COLUMNS FROM tablename-
orlandinho
- Forum Newbie
- Posts: 18
- Joined: Mon Feb 12, 2007 9:50 pm
-
orlandinho
- Forum Newbie
- Posts: 18
- Joined: Mon Feb 12, 2007 9:50 pm
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
Urgs, notepad is utf-8 aware :-S
please run this script on your sql outfile (containing at least one Ñ). What does it say about iso/utf?
So this tells us nothing. Ok, back to square one.Windows XP Professional Product Documentation wrote:Notepad allows you to create and open documents in several different formats: ANSI, Unicode, big-endian Unicode, or UTF-8.
Code: Select all
<?php
$datafile = '...'; // <- enter outfile here
$c = file_get_contents($datafile);
echo 'iso-8859-1: ', strpos($c, chr(209)) ? 'yes':'no', "<br />\n";
echo 'utf-8: ', strpos($c, chr(195).chr(145)) ? 'yes':'no', "<br />\n";
?>-
orlandinho
- Forum Newbie
- Posts: 18
- Joined: Mon Feb 12, 2007 9:50 pm