From: | Murtuza Zabuawala <murtuza(dot)zabuawala(at)enterprisedb(dot)com> |
---|---|
To: | Dave Page <dpage(at)pgadmin(dot)org> |
Cc: | pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org> |
Subject: | Re: PATCH: Encoding issue with qtLiteral function (pgAdmin4) |
Date: | 2016-07-27 12:37:41 |
Message-ID: | CAKKotZQmyVg8eJD8+Ha+fNg=MUX_i6YcUJCkJwzp_sWf3mC=uA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgadmin-hackers |
Okay, Let me check on that.
Meanwhile I'm attaching patch for making Provider optional in security
labels control.
Regards,
Murtuza
--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
On Wed, Jul 27, 2016 at 5:04 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:
> Hi
>
> On Wed, Jul 27, 2016 at 12:18 PM, Murtuza Zabuawala
> <murtuza(dot)zabuawala(at)enterprisedb(dot)com> 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
>
Attachment | Content-Type | Size |
---|---|---|
Fix_SecLabls.patch | application/octet-stream | 5.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Ashesh Vashi | 2016-07-27 13:23:12 | Re: patch for issue RM1260 [pgAdmin4] |
Previous Message | Navnath Gadakh | 2016-07-27 12:19:20 | Re: pgAdmin IV : Unittest modular patch |