I have txt pipe-delimited file (non-english - given below is Polish, but other langs are also involved), encoded utf16, something like:
brytyjski wytwórca|z jakże bogatą|przedwojenną historią|zapowiedział wypuszczenie
dziś znamy|jedynie paletę kolorów|obejmującą aż|jedną pozycję
I tried lots of different ways to get it into mysql table:
line-by-line using php
using LOAD DATA INFILE via console in any way I could conceive, e.g.:
LOAD DATA INFILE 'C:/\wamp/\www/\hmvc/\prop_tst.txt' INTO TABLE hmvc.table CHARACTER SET 'utf8' FIELDS TERMINATED BY '|' LINES TERMINATED BY '\n' \g
I always get either:
garbled (wrongly encoded) entries
nothing gets entered (sql writes default values)
Just to mention: I also set table in utf8, utf16, latin2 (for Eastern European encoding) ... and nada.
When I change encoding , e.g. in Notepad to utf8 I can import - no problem, but what if I have chars requiring utf16 (Asian), or I want to automate file input?
Php iconv etc. seems not to be up to the job.
Any help, link to some reading etc. would be much appreciated, as I am freshly out of ideas.
As documented under
LOAD DATA INFILE Syntax:
It is not possible to load data files that use the
UTF-8 can represent the same full set of Unicode codepoints as UTF-16. Perhaps it'd be easiest to use only that encoding (or transcode the file prior to import in some other language, such as via PHP's