public inbox for [email protected]  
help / color / mirror / Atom feed
From: Dave Page <[email protected]>
To: Murtuza Zabuawala <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: PATCH: Encoding issue with qtLiteral function (pgAdmin4)
Date: Wed, 27 Jul 2016 12:34:41 +0100
Message-ID: <CA+OCxoxf9shrYLa_WyZL5V2FKxV+Mu2UfjCBJCFNv50qyCrJwQ@mail.gmail.com> (raw)
In-Reply-To: <CAKKotZT2YcvNF-cr3XV_EGiWhc-mPvGZCe5r62YFYbx6Zxvhyw@mail.gmail.com>
References: <CAKKotZR5b=JjkC5cS2x=TzVY2MfEhc+eHpcbMm41eW5jv4uYBA@mail.gmail.com>
	<CA+OCxow2ZO0RRELTnQo45o+mqX6GJpEEHzuZYGg0g6D6msb_9w@mail.gmail.com>
	<CAKKotZQNGSBSa=XjhKfDgBgMpAXEQUaMrBnNkW_F58q2CkdvLQ@mail.gmail.com>
	<CA+OCxoxcKKbHqmhaaOZKQLk1tqTkpereYzN5vCz3zS3oZbUM7A@mail.gmail.com>
	<CAKKotZRH-go6m2uhpVOs9-ps4SiLFvfbjeV5mf9NK+=GztToXw@mail.gmail.com>
	<CA+OCxozYsK_aV5Gwh95-dm4m3HoeS8VS4KwX4Ds7PUXcvmH6eg@mail.gmail.com>
	<CA+OCxowMFzdQm1fQPPAPF3je_-x6oh95XPYX3rW27R0DkYsVFQ@mail.gmail.com>
	<CAKKotZT2YcvNF-cr3XV_EGiWhc-mPvGZCe5r62YFYbx6Zxvhyw@mail.gmail.com>
List-Unsubscribe:  <mailto:[email protected]?body=unsub%20pgadmin-hackers>

Hi

On Wed, Jul 27, 2016 at 12:18 PM, Murtuza Zabuawala
<[email protected]> wrote:
> Hi Dave,
>
> 1) Unicode conversion was working properly for function node, It was failing
> due to wrong sql templates.
> - I've fixed them.

I just did a test, and it's still failing - see the attached
screenshot. Aside from the encoding issue, it looks like it's adding
extra quotes around the parameter data type - double-double quoting
the schema and type, and then quoting the whole lot again in the
CREATE part. The ALTER part looks fine.

> 2) Type is also working fine with encoding for me(PFA screenshots), Can you
> please provide error you got?

Hmm, I can't reproduce that now. Weird.

> This patch also makes Provider optional in security label control &
> templates.
>
> -------
> Regarding enforcing to utf-8, In my opinion we can enforce everything to
> utf-8 if we use any of one python version but to make it compatible with
> both python2 and python3 version by forcing utf-8 encoding it will be
> difficult to handle its side effects.

Urgh. Ok, thanks.

> Python2,
>
>>>> txt_sample = 'Hello'
>>>> isinstance(txt_sample, str)
> True
>>>> isinstance(txt_sample, bytes)
> True
>>>> isinstance(txt_sample, unicode)
> False
>>>> txt_sample.encode('utf-8')
> 'Hello'
>>>> txt_sample.decode('utf-8')
> u'Hello'
>
> Forcing to unicode in Python2,
>
>>>> txt_sample = u'Hello'
>>>> isinstance(txt_sample, str)
> False
>>>> isinstance(txt_sample, bytes)
> False
>>>> isinstance(txt_sample, unicode)
> True
>
> Python3,
>
>>>> txt_sample = 'Hello'
>>>> isinstance(txt_sample, str)
> True
>>>> isinstance(txt_sample, bytes)
> False
>>>> txt_sample.encode('utf-8')
> b'Hello'
>>>> txt_sample.decode('utf-8')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> AttributeError: 'str' object has no attribute 'decode'
>
>
> And also psycopg2 driver returns text as string in Python2 even if that text
> contains unicode characters, In python3 that just works fine because string
> is Unicode by default.
>
>
> Regards,
> Murtuza
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company



-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Attachments:

  [image/png] Screen Shot 2016-07-27 at 12.31.21.png (83.5K, 2-Screen%20Shot%202016-07-27%20at%2012.31.21.png)
  download | view image

view thread (16+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: PATCH: Encoding issue with qtLiteral function (pgAdmin4)
  In-Reply-To: <CA+OCxoxf9shrYLa_WyZL5V2FKxV+Mu2UfjCBJCFNv50qyCrJwQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox