Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bMuvt-0005YO-KY for pgadmin-hackers@arkaria.postgresql.org; Tue, 12 Jul 2016 10:28:53 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bMuvs-0002Rv-Ms for pgadmin-hackers@arkaria.postgresql.org; Tue, 12 Jul 2016 10:28:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bMuvf-0002DZ-8c for pgadmin-hackers@postgresql.org; Tue, 12 Jul 2016 10:28:39 +0000 Received: from mail-qk0-x22a.google.com ([2607:f8b0:400d:c09::22a]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bMuvb-0006K4-6v for pgadmin-hackers@postgresql.org; Tue, 12 Jul 2016 10:28:38 +0000 Received: by mail-qk0-x22a.google.com with SMTP id p74so9349786qka.0 for ; Tue, 12 Jul 2016 03:28:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=wIK6mzrWWX/OfLA8/R+bZzYxcNMYFVWzqT3xu+2QbdI=; b=DHVtaoHbx3qRNQD01en1LI4huaYsQ0i6za2erV6ZjXg4zoPIA3dDFPX3pwa08/gteP k2MYLeaKvBuSDR4L5/RcLvQxjAa4TDJOOCjtKRi/3DbsM8IvPOWnpYZU6FA/xEAjM5rp hI787iCQfXEK+P7wCQyd5jNHKhqpMFEkM1GjNmshLo3/A9cYhYDSaTwNYm0ye1yiH0ym gk3F7xb3GnNbIVN9yqAq2Ch4nSiHrSI9r2/VeMrUGj1sqB6JRzHI3vJqIQ7s/XHLByHU fJLutBNIG0zfm8ibYV5V3S7ZMGpuKoZkpXvSJEPNVhNqG6zbqGTWBWFFSlT4aH23Rjvv 7+CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=wIK6mzrWWX/OfLA8/R+bZzYxcNMYFVWzqT3xu+2QbdI=; b=QemWO6+ZjYaU0DeTsB0ggYoz0Z1nxttZF8Cj5oLP81V7cECjfrLJaNvLqiFfX1TJK7 Hq2cLG6wj4EzSf+6QcCYcO/ovN5Qva9oZe0EOscCD8j+MKlzCiMH3DE/p/xVs7CIdCtx Lc+fcwQG/oVkhZo1ApYxn4w4dnWYTZDyIBgcoPrMnFcBG2X6DLtAVaSsTOAnLMGniaOA 00phAVdCvWBagpok8///hSzPGpztikBiecoFXFFDqNFAjIp4I7XYUqTHX5kWAfOTZn+X p3y9/LaPDRLTgaN4BxzP25szdn6EwBPW8Pkev2I3fPqLI96ygMcLp31Du/iuo0Rpfp8L VENw== X-Gm-Message-State: ALyK8tIFspVXGhlxHZYa7/4bi+62I58EtmyyzuUNR8qGCphqs/lCr6xjqND05+/h6Oj6IoXZzy1YpwfaoVJFjAeL X-Received: by 10.55.190.134 with SMTP id o128mr1827210qkf.181.1468319312769; Tue, 12 Jul 2016 03:28:32 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.8.3 with HTTP; Tue, 12 Jul 2016 03:28:13 -0700 (PDT) In-Reply-To: References: From: Murtuza Zabuawala Date: Tue, 12 Jul 2016 15:58:13 +0530 Message-ID: Subject: Re: [pgAdmin4][Patch]: Regarding RM#1419 - Internal Server Error displayed if create any object through simplified Chinese character To: Surinder Kumar Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary=94eb2c043a400e0a3405376dbb4e X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgadmin-hackers Precedence: bulk Sender: pgadmin-hackers-owner@postgresql.org --94eb2c043a400e0a3405376dbb4e Content-Type: text/plain; charset=UTF-8 May be because of Python2.7 but if you try in Python3. It works. we can use PEP 0263 to fix this issue. // # -*- coding: utf-8 -*- -- Regards, Murtuza Zabuawala EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company On Tue, Jul 12, 2016 at 3:48 PM, Surinder Kumar < surinder.kumar@enterprisedb.com> wrote: > On Tue, Jul 12, 2016 at 3:43 PM, Murtuza Zabuawala < > murtuza.zabuawala@enterprisedb.com> wrote: > >> Hi, >> >> Just a heads up, This issue is occurs only in runtime & If you try in web >> everything works fine when you provide unicode characters as object name. >> > No, this issue is reported for both web and runtime application. It is > reproducible to me in web application. > >> >> Now sure but the issue is when runtime(QtWebkit) sends data it does not >> encodes it properly & this should be generic fix in runtime. >> >> Regards, >> Murtuza >> >> -- >> Regards, >> Murtuza Zabuawala >> EnterpriseDB: http://www.enterprisedb.com >> The Enterprise PostgreSQL Company >> >> On Tue, Jul 12, 2016 at 3:27 PM, Surinder Kumar < >> surinder.kumar@enterprisedb.com> wrote: >> >>> Hi >>> >>> *What is happening in code?* >>> Database is created with Chinese characters successfully with ascii >>> values(Chinese characters converted to ascii) before saving internally. >>> >>> but when database properties is retrieved by name, it fails to fetch >>> data and throws UnicodeError. >>> >>> *Solution:* >>> Database name should be encoded in 'utf-8' before storing to database. >>> This resolved the issue. >>> I have tested this patch by creating database name using Japanese and >>> Chinese characters. It works. >>> >>> Also referenced the code to *set default encoding to 'uff-8' *before >>> start of application. >>> https://github.com/joeyespo/grip/issues/86 >>> >>> @Ashesh/@Dave can you please review the patch? >>> If it looks good, we can do the same changes in case of other nodes. >>> >>> Thanks, >>> Surinder Kumar >>> >>> >>> >>> >>> >>> -- >>> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) >>> To make changes to your subscription: >>> http://www.postgresql.org/mailpref/pgadmin-hackers >>> >>> >> > --94eb2c043a400e0a3405376dbb4e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
May be because of Python2.7 but if you try in Python3= . It works.

we can use=C2=A0PEP 0= 263=C2=A0to fix this issue. =C2=A0// # -*- coding: utf-8 -*-

--
Regards,
= Murtuza Zabuawala
EnterpriseDB:=C2=A0= http://www.enterprisedb.com
The Ente= rprise PostgreSQL Company


On Tue, Jul 12, 2016 at 3:48 PM, Surinder Ku= mar <surinder.kumar@enterprisedb.com> wrote:
On Tue, Jul 12, 2016 at 3:43 PM, Murtuz= a Zabuawala <murtuza.zabuawala@enterprisedb.com> wrote:
Hi,

Just a heads up, This i= ssue is occurs only in runtime & If you try in web everything works fin= e when you provide unicode characters as object name.
No, this issue is reported for both web and runtime application. It= is reproducible to me in web application.

Now sure but the issue is when runtime(QtWebki= t) sends data it does not encodes it properly & this should be generic = fix in runtime.

Regards,
Murtuza

--
<= font color=3D"#888888">Murtuza Zabuawala
EnterpriseDB:=C2=A0<= a href=3D"http://www.enterprisedb.com/" rel=3D"noreferrer" style=3D"color:r= gb(17,85,204)" target=3D"_blank">http://www.enterprisedb.com
The Ente= rprise PostgreSQL Company

On Tue, Jul 12, 2016 at 3:27 PM, S= urinder Kumar <surinder.kumar@enterprisedb.com> wrote:
Hi
=
What is happening in code?
Database is= created with Chinese characters successfully with ascii values(Chinese cha= racters converted to ascii) before saving internally.

<= div>but when database properties is retrieved by name, it fails to fetch da= ta and throws UnicodeError.

Solution:
=
Database name should be encoded in 'utf-8' before storing to d= atabase.
This resolved the issue.=C2=A0
I have tested t= his patch by creating database name using Japanese and Chinese characters. = It works.

Also referenced the code to set defau= lt encoding to 'uff-8' before start of application.
<= a href=3D"https://github.com/joeyespo/grip/issues/86" target=3D"_blank">htt= ps://github.com/joeyespo/grip/issues/86

@A= shesh/@Dave can you please review the patch?
If it looks good, we= can do the same changes in case of other nodes.

T= hanks,
Surinder Kumar




= --
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers=




--94eb2c043a400e0a3405376dbb4e--