Re: Pgadmin4: emoji in comments

From: Murtuza Zabuawala <murtuza(dot)zabuawala(at)enterprisedb(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: eMerzh <merzhin(at)gmail(dot)com>, Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>, pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: Pgadmin4: emoji in comments
Date: 2016-06-10 07:02:03
Message-ID: CAKKotZREBb_2FvraaadpXUf7xQuRTvumzW3A3m6xVvEp1uT1PA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi,

This seems to issue with psycopg2. (
https://github.com/psycopg/psycopg2/issues/331)

To resolve this issue we have two solutions,

*Solution-1*
we can upgrade the psycopg2 module to newer version

*Solution-2*
Re-write of our 'qtLiteral' implementation which also accepts current
connection object as parameter and using that we can prepare "adapt" for
encoding used by current connection but this will affects almost every
module (sql template related changes).

Regards,
Murtuza

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Mon, Jun 6, 2016 at 1:32 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:

> Hi
>
> On Fri, Jun 3, 2016 at 11:28 PM, eMerzh <merzhin(at)gmail(dot)com> wrote:
> > Hi,
> >
> > i just pulled the latest git,
> > and tried to display a table with an emoji in comments of the table
> > and i got an exception...
> >
> > using python3.5
> > 4398d1d8694024b3f357e74fba4683d5f3cd5745
> >
> > here is the traceback
> >
> > 2016-06-04 00:23:15,050: ERROR pgadmin: Exception on
> > /browser/table/sql/1/1/25554/2200/34037 [GET]
> > Traceback (most recent call last):
> > File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/app.py",
> line
> > 1817, in wsgi_app
> > response = self.full_dispatch_request()
> > File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/app.py",
> line
> > 1477, in full_dispatch_request
> > rv = self.handle_user_exception(e)
> > File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/app.py",
> line
> > 1381, in handle_user_exception
> > reraise(exc_type, exc_value, tb)
> > File
> "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/_compat.py",
> > line 33, in reraise
> > raise value
> > File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/app.py",
> line
> > 1475, in full_dispatch_request
> > rv = self.dispatch_request()
> > File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/app.py",
> line
> > 1461, in dispatch_request
> > return self.view_functions[rule.endpoint](**req.view_args)
> > File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/views.py",
> > line 84, in view
> > return self.dispatch_request(*args, **kwargs)
> > File "/tmp/pgadmin4/web/pgadmin/browser/utils.py", line 233, in
> > dispatch_request
> > return method(*args, **kwargs)
> > File
> >
> "/tmp/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py",
> > line 328, in wrap
> > return f(*args, **kwargs)
> > File
> >
> "/tmp/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py",
> > line 2437, in sql
> > data=data, conn=self.conn)
> > File
> > "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/templating.py",
> line
> > 128, in render_template
> > context, ctx.app)
> > File
> > "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/templating.py",
> line
> > 110, in _render
> > rv = template.render(context)
> > File
> > "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/jinja2/environment.py",
> > line 969, in render
> > return self.environment.handle_exception(exc_info, True)
> > File
> > "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/jinja2/environment.py",
> > line 742, in handle_exception
> > reraise(exc_type, exc_value, tb)
> > File
> "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/jinja2/_compat.py",
> > line 36, in reraise
> > raise value.with_traceback(tb)
> > File
> >
> "/tmp/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.5_plus/create.sql",
> > line 123, in <module>
> > IS {{c.description|qtLiteral}};
> > File "/tmp/pgadmin4/web/pgadmin/utils/driver/psycopg2/__init__.py",
> line
> > 1405, in qtLiteral
> > res = adapt(value).getquoted()
> > UnicodeEncodeError: 'latin-1' codec can't encode character '\U0001f4a9'
> in
> > position 6: ordinal not in range(256)
> > 2016-06-04 00:23:17,443: ERROR pgadmin: Exception on
> > /browser/table/sql/1/1/25554/2200/34037 [GET]
> > Traceback (most recent call last):
> > File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/app.py",
> line
> > 1817, in wsgi_app
> > response = self.full_dispatch_request()
> > File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/app.py",
> line
> > 1477, in full_dispatch_request
> > rv = self.handle_user_exception(e)
> > File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/app.py",
> line
> > 1381, in handle_user_exception
> > reraise(exc_type, exc_value, tb)
> > File
> "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/_compat.py",
> > line 33, in reraise
> > raise value
> > File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/app.py",
> line
> > 1475, in full_dispatch_request
> > rv = self.dispatch_request()
> > File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/app.py",
> line
> > 1461, in dispatch_request
> > return self.view_functions[rule.endpoint](**req.view_args)
> > File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/views.py",
> > line 84, in view
> > return self.dispatch_request(*args, **kwargs)
> > File "/tmp/pgadmin4/web/pgadmin/browser/utils.py", line 233, in
> > dispatch_request
> > return method(*args, **kwargs)
> > File
> >
> "/tmp/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py",
> > line 328, in wrap
> > return f(*args, **kwargs)
> > File
> >
> "/tmp/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py",
> > line 2437, in sql
> > data=data, conn=self.conn)
> > File
> > "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/templating.py",
> line
> > 128, in render_template
> > context, ctx.app)
> > File
> > "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/templating.py",
> line
> > 110, in _render
> > rv = template.render(context)
> > File
> > "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/jinja2/environment.py",
> > line 969, in render
> > return self.environment.handle_exception(exc_info, True)
> > File
> > "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/jinja2/environment.py",
> > line 742, in handle_exception
> > reraise(exc_type, exc_value, tb)
> > File
> "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/jinja2/_compat.py",
> > line 36, in reraise
> > raise value.with_traceback(tb)
> > File
> >
> "/tmp/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.5_plus/create.sql",
> > line 123, in <module>
> > IS {{c.description|qtLiteral}};
> > File "/tmp/pgadmin4/web/pgadmin/utils/driver/psycopg2/__init__.py",
> line
> > 1405, in qtLiteral
> > res = adapt(value).getquoted()
> > UnicodeEncodeError: 'latin-1' codec can't encode character '\U0001f4a9'
> in
> > position 6: ordinal not in range(256)
> >
> > btw, sorry to reach you guys directly but i can't post on *-hackers and
> > don't think there is a bug tracker somewhere?
>
> You seem to have posted on -hackers, though I had to approve it :-)
>
> The bug tracker can be found here:
> https://redmine.postgresql.org/projects/pgadmin4/issues
>
> I'll log this one for now - thanks!
>
> --
> 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 (pgadmin-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Surinder Kumar 2016-06-10 07:03:22 [pgAdmin4][Patch]: RM#1327 After selecting the expiry date for role , the calendar box not disappearing
Previous Message Dave Page 2016-06-09 14:48:42 Re: Patch for pgAdmin4 RPM package