public inbox for [email protected]help / color / mirror / Atom feed
[pgAdmin4][Patch]: Regarding RM#1419 - Internal Server Error displayed if create any object through simplified Chinese character 8+ messages / 3 participants [nested] [flat]
* [pgAdmin4][Patch]: Regarding RM#1419 - Internal Server Error displayed if create any object through simplified Chinese character @ 2016-07-12 09:57 Surinder Kumar <[email protected]> 0 siblings, 1 reply; 8+ messages in thread From: Surinder Kumar @ 2016-07-12 09:57 UTC (permalink / raw) To: pgadmin-hackers 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 ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers Attachments: [application/octet-stream] RM#1419.patch (2.1K, 3-RM%231419.patch) download | inline diff: diff --git a/web/pgAdmin4.py b/web/pgAdmin4.py index b679cd6..eb75931 100644 --- a/web/pgAdmin4.py +++ b/web/pgAdmin4.py @@ -86,6 +86,12 @@ if not PGADMIN_RUNTIME: (config.APP_NAME, server_port)) sys.stdout.flush() +# To handle non-english characters set default encoding +# to utf-8 +# Referenced from https://github.com/joeyespo/grip/issues/86 +reload(sys) +sys.setdefaultencoding('utf-8') + try: app.run( host=config.DEFAULT_SERVER, diff --git a/web/pgadmin/browser/server_groups/servers/databases/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/__init__.py index 1f7fd07..34007ae 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/__init__.py @@ -11,6 +11,7 @@ import json import re +import sys from functools import wraps import pgadmin.browser.server_groups.servers as servers @@ -453,6 +454,7 @@ class DatabaseView(PGChildNodeView): ) ) try: + data['name'] = data['name'].encode(sys.getdefaultencoding()) # The below SQL will execute CREATE DDL only SQL = render_template( "/".join([self.template_path, 'create.sql']), diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py index 377e6f7..b35d932 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/__init__.py @@ -9,6 +9,7 @@ import json import re +import sys from functools import wraps import pgadmin.browser.server_groups.servers as servers @@ -509,6 +510,7 @@ It may have been removed by another user. ) try: self.format_request_acls(data) + data['name'] = data['name'].encode(sys.getdefaultencoding()) SQL = render_template( "/".join([self.template_path, 'sql/create.sql']), data=data, conn=self.conn, _=gettext ^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgAdmin4][Patch]: Regarding RM#1419 - Internal Server Error displayed if create any object through simplified Chinese character @ 2016-07-12 10:13 Murtuza Zabuawala <[email protected]> parent: Surinder Kumar <[email protected]> 0 siblings, 1 reply; 8+ messages in thread From: Murtuza Zabuawala @ 2016-07-12 10:13 UTC (permalink / raw) To: Surinder Kumar <[email protected]>; +Cc: pgadmin-hackers 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. 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 < [email protected]> 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 ([email protected]) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgadmin-hackers > > ^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgAdmin4][Patch]: Regarding RM#1419 - Internal Server Error displayed if create any object through simplified Chinese character @ 2016-07-12 10:18 Surinder Kumar <[email protected]> parent: Murtuza Zabuawala <[email protected]> 0 siblings, 2 replies; 8+ messages in thread From: Surinder Kumar @ 2016-07-12 10:18 UTC (permalink / raw) To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers On Tue, Jul 12, 2016 at 3:43 PM, Murtuza Zabuawala < [email protected]> 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 < > [email protected]> 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 ([email protected]) >> To make changes to your subscription: >> http://www.postgresql.org/mailpref/pgadmin-hackers >> >> > ^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgAdmin4][Patch]: Regarding RM#1419 - Internal Server Error displayed if create any object through simplified Chinese character @ 2016-07-12 10:27 Surinder Kumar <[email protected]> parent: Surinder Kumar <[email protected]> 1 sibling, 0 replies; 8+ messages in thread From: Surinder Kumar @ 2016-07-12 10:27 UTC (permalink / raw) To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers On Tue, Jul 12, 2016 at 3:48 PM, Surinder Kumar < [email protected]> wrote: > On Tue, Jul 12, 2016 at 3:43 PM, Murtuza Zabuawala < > [email protected]> 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. > It is reproducible for me on Mac OS X Yosemite version 10.10.2 Python version: 2.7 Browsers: Chrome & Firefox. > >> 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 < >> [email protected]> 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 ([email protected]) >>> To make changes to your subscription: >>> http://www.postgresql.org/mailpref/pgadmin-hackers >>> >>> >> > ^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgAdmin4][Patch]: Regarding RM#1419 - Internal Server Error displayed if create any object through simplified Chinese character @ 2016-07-12 10:28 Murtuza Zabuawala <[email protected]> parent: Surinder Kumar <[email protected]> 1 sibling, 1 reply; 8+ messages in thread From: Murtuza Zabuawala @ 2016-07-12 10:28 UTC (permalink / raw) To: Surinder Kumar <[email protected]>; +Cc: pgadmin-hackers May be because of Python2.7 but if you try in Python3. It works. we can use PEP 0263 <http://www.python.org/dev/peps/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 < [email protected]> wrote: > On Tue, Jul 12, 2016 at 3:43 PM, Murtuza Zabuawala < > [email protected]> 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 < >> [email protected]> 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 ([email protected]) >>> To make changes to your subscription: >>> http://www.postgresql.org/mailpref/pgadmin-hackers >>> >>> >> > ^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgAdmin4][Patch]: Regarding RM#1419 - Internal Server Error displayed if create any object through simplified Chinese character @ 2016-07-12 10:37 Ashesh Vashi <[email protected]> parent: Murtuza Zabuawala <[email protected]> 0 siblings, 1 reply; 8+ messages in thread From: Ashesh Vashi @ 2016-07-12 10:37 UTC (permalink / raw) To: Murtuza Zabuawala <[email protected]>; +Cc: Surinder Kumar <[email protected]>; pgadmin-hackers On Tue, Jul 12, 2016 at 3:58 PM, Murtuza Zabuawala < [email protected]> wrote: > May be because of Python2.7 but if you try in Python3. It works. > > we can use PEP 0263 <http://www.python.org/dev/peps/pep-0263/; to fix > this issue. // # -*- coding: utf-8 -*- > Isn't this about the source code encoding, and not about the input encoding? -- Thanks & Regards, Ashesh Vashi EnterpriseDB INDIA: Enterprise PostgreSQL Company <http://www.enterprisedb.com/; *http://www.linkedin.com/in/asheshvashi* <http://www.linkedin.com/in/asheshvashi; > > > -- > Regards, > Murtuza Zabuawala > EnterpriseDB: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > > On Tue, Jul 12, 2016 at 3:48 PM, Surinder Kumar < > [email protected]> wrote: > >> On Tue, Jul 12, 2016 at 3:43 PM, Murtuza Zabuawala < >> [email protected]> 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 < >>> [email protected]> 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 ([email protected]) >>>> To make changes to your subscription: >>>> http://www.postgresql.org/mailpref/pgadmin-hackers >>>> >>>> >>> >> > ^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgAdmin4][Patch]: Regarding RM#1419 - Internal Server Error displayed if create any object through simplified Chinese character @ 2016-07-12 10:48 Surinder Kumar <[email protected]> parent: Ashesh Vashi <[email protected]> 0 siblings, 1 reply; 8+ messages in thread From: Surinder Kumar @ 2016-07-12 10:48 UTC (permalink / raw) To: Ashesh Vashi <[email protected]>; +Cc: Murtuza Zabuawala <[email protected]>; pgadmin-hackers On Tue, Jul 12, 2016 at 4:07 PM, Ashesh Vashi <[email protected] > wrote: > On Tue, Jul 12, 2016 at 3:58 PM, Murtuza Zabuawala < > [email protected]> wrote: > >> May be because of Python2.7 but if you try in Python3. It works. >> >> we can use PEP 0263 <http://www.python.org/dev/peps/pep-0263/; to fix >> this issue. // # -*- coding: utf-8 -*- >> > I tried but it didn't worked. *It gives me error:* Traceback (most recent call last): File "/Users/surinder/Documents/Projects/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/__init__.py", line 639, in msql status, res = self.get_sql(gid, sid, data, did) File "/Users/surinder/Documents/Projects/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/__init__.py", line 686, in get_sql SQL += self.get_new_sql(gid, sid, data, did) File "/Users/surinder/Documents/Projects/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/__init__.py", line 721, in get_new_sql data=data, conn=self.conn File "/Users/surinder/Documents/Workspaces/pgAdmin_27/lib/python2.7/site-packages/flask/templating.py", line 128, in render_template context, ctx.app) File "/Users/surinder/Documents/Workspaces/pgAdmin_27/lib/python2.7/site-packages/flask/templating.py", line 110, in _render rv = template.render(context) File "/Users/surinder/Documents/Workspaces/pgAdmin_27/lib/python2.7/site-packages/jinja2/environment.py", line 969, in render return self.environment.handle_exception(exc_info, True) File "/Users/surinder/Documents/Workspaces/pgAdmin_27/lib/python2.7/site-packages/jinja2/environment.py", line 742, in handle_exception reraise(exc_type, exc_value, tb) File "/Users/surinder/Documents/Projects/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/9.3_plus/create.sql", line 3, in top-level template code CREATE DATABASE {{ conn|qtIdent(data.name) }} File "/Users/surinder/Documents/Projects/pgadmin4/web/pgadmin/utils/driver/psycopg2/__init__.py", line 1597, in qtIdent val = str(val) UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-8: ordinal not in range(128) > Isn't this about the source code encoding, and not about the input > encoding? > > -- > > Thanks & Regards, > > Ashesh Vashi > EnterpriseDB INDIA: Enterprise PostgreSQL Company > <http://www.enterprisedb.com/; > > > *http://www.linkedin.com/in/asheshvashi* > <http://www.linkedin.com/in/asheshvashi; > >> >> >> -- >> Regards, >> Murtuza Zabuawala >> EnterpriseDB: http://www.enterprisedb.com >> The Enterprise PostgreSQL Company >> >> On Tue, Jul 12, 2016 at 3:48 PM, Surinder Kumar < >> [email protected]> wrote: >> >>> On Tue, Jul 12, 2016 at 3:43 PM, Murtuza Zabuawala < >>> [email protected]> 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 < >>>> [email protected]> 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 ([email protected]) >>>>> To make changes to your subscription: >>>>> http://www.postgresql.org/mailpref/pgadmin-hackers >>>>> >>>>> >>>> >>> >> > ^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [pgAdmin4][Patch]: Regarding RM#1419 - Internal Server Error displayed if create any object through simplified Chinese character @ 2016-07-12 11:11 Murtuza Zabuawala <[email protected]> parent: Surinder Kumar <[email protected]> 0 siblings, 0 replies; 8+ messages in thread From: Murtuza Zabuawala @ 2016-07-12 11:11 UTC (permalink / raw) To: Surinder Kumar <[email protected]>; +Cc: Ashesh Vashi <[email protected]>; pgadmin-hackers Please refer, http://stackoverflow.com/questions/3828723/why-should-we-not-use-sys-setdefaultencodingutf-8-in-a-py... -- Regards, Murtuza Zabuawala EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company On Tue, Jul 12, 2016 at 4:18 PM, Surinder Kumar < [email protected]> wrote: > On Tue, Jul 12, 2016 at 4:07 PM, Ashesh Vashi < > [email protected]> wrote: > >> On Tue, Jul 12, 2016 at 3:58 PM, Murtuza Zabuawala < >> [email protected]> wrote: >> >>> May be because of Python2.7 but if you try in Python3. It works. >>> >>> we can use PEP 0263 <http://www.python.org/dev/peps/pep-0263/; to fix >>> this issue. // # -*- coding: utf-8 -*- >>> >> I tried but it didn't worked. > *It gives me error:* > Traceback (most recent call last): > File > "/Users/surinder/Documents/Projects/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/__init__.py", > line 639, in msql > status, res = self.get_sql(gid, sid, data, did) > File > "/Users/surinder/Documents/Projects/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/__init__.py", > line 686, in get_sql > SQL += self.get_new_sql(gid, sid, data, did) > File > "/Users/surinder/Documents/Projects/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/__init__.py", > line 721, in get_new_sql > data=data, conn=self.conn > File > "/Users/surinder/Documents/Workspaces/pgAdmin_27/lib/python2.7/site-packages/flask/templating.py", > line 128, in render_template > context, ctx.app) > File > "/Users/surinder/Documents/Workspaces/pgAdmin_27/lib/python2.7/site-packages/flask/templating.py", > line 110, in _render > rv = template.render(context) > File > "/Users/surinder/Documents/Workspaces/pgAdmin_27/lib/python2.7/site-packages/jinja2/environment.py", > line 969, in render > return self.environment.handle_exception(exc_info, True) > File > "/Users/surinder/Documents/Workspaces/pgAdmin_27/lib/python2.7/site-packages/jinja2/environment.py", > line 742, in handle_exception > reraise(exc_type, exc_value, tb) > File > "/Users/surinder/Documents/Projects/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/templates/databases/sql/9.3_plus/create.sql", > line 3, in top-level template code > CREATE DATABASE {{ conn|qtIdent(data.name) }} > File > "/Users/surinder/Documents/Projects/pgadmin4/web/pgadmin/utils/driver/psycopg2/__init__.py", > line 1597, in qtIdent > val = str(val) > UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-8: > ordinal not in range(128) > > >> Isn't this about the source code encoding, and not about the input >> encoding? >> >> -- >> >> Thanks & Regards, >> >> Ashesh Vashi >> EnterpriseDB INDIA: Enterprise PostgreSQL Company >> <http://www.enterprisedb.com/; >> >> >> *http://www.linkedin.com/in/asheshvashi* >> <http://www.linkedin.com/in/asheshvashi; >> >>> >>> >>> -- >>> Regards, >>> Murtuza Zabuawala >>> EnterpriseDB: http://www.enterprisedb.com >>> The Enterprise PostgreSQL Company >>> >>> On Tue, Jul 12, 2016 at 3:48 PM, Surinder Kumar < >>> [email protected]> wrote: >>> >>>> On Tue, Jul 12, 2016 at 3:43 PM, Murtuza Zabuawala < >>>> [email protected]> 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 < >>>>> [email protected]> 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 ([email protected] >>>>>> ) >>>>>> To make changes to your subscription: >>>>>> http://www.postgresql.org/mailpref/pgadmin-hackers >>>>>> >>>>>> >>>>> >>>> >>> >> > ^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2016-07-12 11:11 UTC | newest] Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2016-07-12 09:57 [pgAdmin4][Patch]: Regarding RM#1419 - Internal Server Error displayed if create any object through simplified Chinese character Surinder Kumar <[email protected]> 2016-07-12 10:13 ` Murtuza Zabuawala <[email protected]> 2016-07-12 10:18 ` Surinder Kumar <[email protected]> 2016-07-12 10:27 ` Surinder Kumar <[email protected]> 2016-07-12 10:28 ` Murtuza Zabuawala <[email protected]> 2016-07-12 10:37 ` Ashesh Vashi <[email protected]> 2016-07-12 10:48 ` Surinder Kumar <[email protected]> 2016-07-12 11:11 ` Murtuza Zabuawala <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox