Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XNAhJ-0004sO-9B for pgsql-admin@arkaria.postgresql.org; Fri, 29 Aug 2014 01:09:49 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XNAhH-0000f5-Fm for pgsql-admin@arkaria.postgresql.org; Fri, 29 Aug 2014 01:09:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XNAhG-0000ex-5u for pgsql-admin@postgresql.org; Fri, 29 Aug 2014 01:09:46 +0000 Received: from mail-pa0-x22d.google.com ([2607:f8b0:400e:c03::22d]) by magus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1XNAhB-0000OK-Sv for pgsql-admin@postgresql.org; Fri, 29 Aug 2014 01:09:44 +0000 Received: by mail-pa0-f45.google.com with SMTP id bj1so4784553pad.4 for ; Thu, 28 Aug 2014 18:09:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :thread-index:content-language; bh=X6KD2/4lmTQhqEOxx0QVuydYmSTDXFGqGFh7M9m5DP4=; b=nyGR8/WgHTR6bJchcEJgtM+DDY2XJQXk2AwUENwvuFHlQZmKNGGF/Ae3nvfOb+T6FN +Lx3uAC1lkbgE78pWOTsxtMPenAJyj+ERAXEm8halXcGJG3f0w6B/OM70Z0vLvUTqkla bO75vh+Vrux9uImClpUL3oG7BvXzItZHwKKr6QDdDhnfey1b+1A9/fY0fKwYDZdEJNup F+PgHiGJ7PqKVo6yNJhdyoBsgLHEMyZLKhotaK/2kPXJOXzLFWr00Wnjk7AMggZk4lP0 LI2neR+wg02RotRNAS1xfK/VKilB8FwVcS07EzI96dd1C1YBrCfi+u6SbfkWtvi1+zAp iiKA== X-Received: by 10.66.141.165 with SMTP id rp5mr11032984pab.115.1409274578192; Thu, 28 Aug 2014 18:09:38 -0700 (PDT) Received: from YuanyuanPC ([58.58.27.50]) by mx.google.com with ESMTPSA id e11sm7493055pdm.47.2014.08.28.18.09.34 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Aug 2014 18:09:37 -0700 (PDT) From: "liuyuanyuan" To: "'Andreas Joseph Krogh-2 [via PostgreSQL]'" Cc: Subject: Re: invalid byte sequence for encoding "UTF8": 0x00 Date: Fri, 29 Aug 2014 09:09:03 +0800 Message-ID: <001f01cfc325$d614fe20$823efa60$@gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0020_01CFC368.E43B4B60" X-Mailer: Microsoft Outlook 15.0 Thread-Index: Ac/DJJM+VBzkbdRkQg2qJ1vbKUKxPw== Content-Language: zh-cn X-Pg-Spam-Score: 0.1 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org This is a multipart message in MIME format. ------=_NextPart_000_0020_01CFC368.E43B4B60 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks Andreas! =20 I like this clear answer! My colleague and I have found about this in PostgreSQL source code, but = we=E2=80=99re not so sure. Thanks for your reply! =20 Regards! =20 Jasmine Liu =20 =E5=8F=91=E4=BB=B6=E4=BA=BA: Andreas Joseph Krogh-2 [via PostgreSQL] = [mailto:ml-node+s1045698n5816732h11@n5.nabble.com]=20 =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2014=E5=B9=B48=E6=9C=8828=E6=97=A5 = 20:46 =E6=94=B6=E4=BB=B6=E4=BA=BA: JasmineLiu =E4=B8=BB=E9=A2=98: Re: invalid byte sequence for encoding "UTF8": 0x00 =20 P=C3=A5 onsdag 27. august 2014 kl. 10:11:09, skrev Albe Laurenz <[hidden = email]>: JasmineLiu wrote: > I've also got this problem while copy or insert data from MS SQL = Server to > PostgreSQL. > SQLServer 2008 R2, encoding :GBK > PostgreSQL 9.3.4, encoding:UTF8 > > Rather than modify the column value in sql server, > are there any other ways to solve this problem? > Better to give me an examples. You will never be able to insert a null character into a PostgreSQL = database. You can either modify the source data or change the data in transit. =20 This is not 100% true, but is true for text-fields. You can insert \0 = into BYTEA columns. =20 =20 Usually the \0 isn't important so you can do this in JAVA before = inserting into PG: =20 someString.replace('\0', ' ') or someString.replaceAll("\0", "") =20 =20 --=20 Andreas Joseph Krogh CTO / Partner - Visena AS Mobile: +47 909 56 963 [hidden email] www.visena.com =20 =20 =20 =20 _____ =20 If you reply to this email, your message will be added to the discussion = below: http://postgresql.1045698.n5.nabble.com/invalid-byte-sequence-for-encodin= g-UTF8-0x00-tp2172080p5816732.html=20 To unsubscribe from invalid byte sequence for encoding "UTF8": 0x00, = click here = . = NAML=20 ------=_NextPart_000_0020_01CFC368.E43B4B60 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Thanks = Andreas! =C2=A0

= I like this clear answer!

= My colleague and I have found about this in PostgreSQL = source code, but we=E2=80=99re not so sure.

Thanks for your reply!

 

Regards!

 

Jasmine Liu

 

=E5=8F=91=E4=BB=B6=E4=BA=BA: Andreas Joseph Krogh-2 [via PostgreSQL] = [mailto:ml-node+s1045698n5816732h11@n5.nabble.com]
=E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2014=E5=B9=B48=E6=9C=8828=E6=97=A5 = 20:46
=E6=94=B6=E4=BB=B6=E4=BA=BA: = JasmineLiu
=E4=B8=BB=E9=A2=98: Re: invalid byte sequence = for encoding "UTF8": 0x00

 

P=C3=A5 onsdag 27. august 2014 kl. = 10:11:09, skrev Albe Laurenz <[hidden = email]>:

JasmineLiu = wrote:
> I've also got this problem while copy or insert data from = MS SQL Server to
> PostgreSQL.
> SQLServer 2008 R2, encoding = :GBK
> PostgreSQL 9.3.4, encoding:UTF8
>
> Rather than = modify the column value in sql server,
> are  there any other = ways to solve this problem?
> Better to give me an  = examples.

You will never be able to insert a null character into = a PostgreSQL database.
You can either modify the source data or = change the data in = transit.

 

This is not 100% true, but is true = for text-fields. You can insert \0 into = BYTEA columns.

 

 

Usually the \0 isn't important so = you can do this in JAVA before inserting into = PG:

 

someString.replace('\0', ' ') or = someString.replaceAll("\0", = "")

 

 

--

Andreas Joseph = Krogh

CTO / = Partner - Visena = AS

Mobile: +47 909 = 56 963

<= div>

 

 


If you reply to this email, your message will be added to the = discussion below:

http://postgresql.1045698.n5.= nabble.com/invalid-byte-sequence-for-encoding-UTF8-0x00-tp2172080p5816732= .html

To unsubscribe from invalid byte sequence for encoding = "UTF8": 0x00, click here.
NAML =

------=_NextPart_000_0020_01CFC368.E43B4B60--