Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set database encoding to UTF8. #4

Merged
merged 1 commit into from
Nov 16, 2015
Merged

Set database encoding to UTF8. #4

merged 1 commit into from
Nov 16, 2015

Conversation

zhm
Copy link
Contributor

@zhm zhm commented Nov 16, 2015

Fixes error when parsing this statement:

SELECT U&'\0441\043B\043E\043D'

The error is:

Unicode escape values cannot be used for code point values above
007F when the server encoding is not UTF8.

From here: https://github.com/postgres/postgres/blob/master/src/backend/parser/scan.l#L1236-L1247

Perhapes there could be an API to set the encoding used by the
parser. But I think it makes sense to use UTF8 by default.

Fixes error when parsing this statement:

SELECT U&'\0441\043B\043E\043D'

The error is:

Unicode escape values cannot be used for code point values above
007F when the server encoding is not UTF8.

Perhapes there could be an API to set the encoding used by the
parser. But I think it makes sense to use UTF8 by default.
@zhm
Copy link
Contributor Author

zhm commented Nov 16, 2015

The test statement came from http://www.postgresql.org/docs/9.0/static/sql-syntax-lexical.html

@lfittl
Copy link
Member

lfittl commented Nov 16, 2015

Nice, good catch!

I think its safe to assume that you'd almost always want UTF-8 - until someone asks otherwise lets just default to that.

@lfittl lfittl added the bug label Nov 16, 2015
lfittl added a commit that referenced this pull request Nov 16, 2015
Set database encoding to UTF8.
@lfittl lfittl merged commit 5b8475f into pganalyze:master Nov 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants