
The mclient -E option only affects data that flows through mclient, that is, mclient's standard input and standard output. When you use a copy into from file, the file is read directly by the server and not by mclient, and the server wants UTF-8 encoded data. This means that the data file must be UTF-8 encoded. Nothing else will do. My Windows system doesn't speak Chinese, so I can't really test it there, but on Linux it works correctly when I make sure the data is indeed correctly encoded. If you have the data in some other format, you should be able to do something like mclient -Eencoding file where file contains (in the specified encoding): copy 2 records into t1 from stdin using delimiters ',','\r\n'; 1,测试1 2,测试2 But this requires the copy command to be in the file as well. 小波 顾 wrote:
Copy from file which contains Chinese characters failed. My test table is create table t1(a int not null primary key, b varchar(1024)); My test file d:\data.txt contains two lines 1,测试1 2,测试2 I have tried to save the data file using ANSI and UTF8 encoding using Notepad on windows, and tried to start mclient with -Ecp437, -Ecp936 and -Eutf-8 option, neither combination of the file encoding and mclient encoding can load the file correctlly. When both using utf-8 the following error messages appears: sql>copy into t1 from 'd:\\data.txt' using delimiters ',', '\r\n'; !SQLException:importTable:failed to import table !ERROR: value 'ï»?' while parsing 'ï»?,顾å°æ³? !ERROR: 2,覃æ€? from line 0 field 0 not inserted, expecting type int !ERROR: TABLETload_bulk: read error (after loading 0 records) 0 tuples When using other combinations, the following messages appears: sql>copy into t1 from 'd:\\data.txt' using delimiters ',', '\r\n'; 0 tuples write error sql> The following steps works, but the exported data.txt isn't readable by human. mclient XXXXX -Ecp437 delete from t1; insert into t1 values(1,'²âÊÔ1'); insert into t1 values(2,'²âÊÔ2'); copy select * from t1 into 'd:\\data.txt' using delimiters ',' ,'\r\n'; delete from t1; copy into t1 from 'd:\\data.txt' using delimiters ',' ,'\r\n';
------------------------------------------------------------------------ Get news, entertainment and everything you care about at Live.com. Check it out! <http://www.live.com/getstarted.aspx >
------------------------------------------------------------------------
------------------------------------------------------------------------------
------------------------------------------------------------------------
_______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- Sjoerd Mullender