logo       

Sponsor
FREE Network Mapping Tool for Microsoft® Office Visio® Professional 2007
Don't map your network by hand - let LANsurveyor Exx press for Microsoft Visio Professional 2007 automatically create network diagrams for you!

Re: COPY Command UtfToLocal: could not convert UTF-8: msg#00074

db.postgresql.jdbc

Subject: Re: COPY Command UtfToLocal: could not convert UTF-8



On Wed, 10 Mar 2004, kerdem wrote:

> I installed PG 7.3.4 and created DB with encoding “LATIN10” . I tried
> to import Flat-File with Copy Command
>
> String delimeter ;";
> String FILEPATH ="/home/kerdem/upstream/LIQ.txt";
> String pgcopy ="copy public.liq_import from '"+FILEPATH+"' with
> delimiter '"+delimeter+"' NULL AS '' ";
>
> pstmt = con.prepareStatement(pgcopy);
> pstmt.executeUpdate();
> pstmt.close();
>
> WARNING: copy: line 2, UtfToLocal: could not convert UTF-8 (0xe47469).
> Ignored
>
> But wenn I use same command from psql console in DB I can import all
> of the special letter,
>
> copy public.liq_import from '/home/kerdem/upstream/LIQ.txt' delimiter
> ';' NULL as '' ;
>

I imagine this problem is a result of the JDBC driver setting the
client_encoding variable to unicode (which it needs to function properly),
this is making the COPY command think the file has a unicode encoding.
When connecting with psql your client_encoding defaults to the database
encoding which I imagine is what the file is encoded as.

As to how to solve this problem? It is possible to SET the
client_encoding temporarily and then reset it after the COPY is done, but
this is something I hesitate to recommend because it's definitely not
something the JDBC driver wants you doing. I'm not sure what else to
could be done, extend the COPY command to take an encoding argument?

Kris Jurka

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend






Only community members can participate in forum threads. You must Register or log in to contribute.

<Prev in Thread] Current Thread [Next in Thread>
Sponsor
FREE Network Mapping Tool for Microsoft® OfficeVisio Professional 2007
Don't map your network by hand - let LANsurveyor Express for Microsoft Visio Professional 2007
automatically create network diagrams for you!
Google Custom Search

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation

Home | sitemap | advertise | OSDir is an inevitable website. super tiny logo