Encoding error

66 views
Skip to first unread message

Jacek Ziora

unread,
Jun 13, 2016, 8:42:21 AM6/13/16
to Repo and Gerrit Discussion
Hi!

I have weird problem. When I type in search bar for example owner: <user_name> after each character I've got an error:
Code Review - Error
500 Internal server error

In log:
[HTTP-387] ERROR com.google.gerrit.httpd.restapi.RestApiServlet : Error in GET /accounts/?q=g&n=20
com.google.gwtorm.server.OrmException: fetch failure on accounts
...
ERROR: character with byte sequence 0xe9 0xbe 0xa5 in encoding "UTF8" has no equivalent in encoding "LATIN1"

So I tried to change encoding in my database. In database I've executed:
reviewdb_new=# \encoding UTF8

But this doesn't work and when I exit and enter db again encoding is LATINI1 again...

How to change this encoding in database? Or maybe there is another way to solve this?

Best regards,
Jacek Ziora

Edwin Kempin

unread,
Jun 13, 2016, 8:54:11 AM6/13/16
to Jacek Ziora, Repo and Gerrit Discussion
I guess this much depends on which database you are using.
 
Or maybe there is another way to solve this?

Best regards,
Jacek Ziora

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jacek Ziora

unread,
Jun 13, 2016, 9:03:07 AM6/13/16
to Repo and Gerrit Discussion, jacek.ad...@gmail.com
Sorry, my mistake!
I use postgresql database (postgresql-9.4.1)

Matthias Sohn

unread,
Jun 13, 2016, 9:39:12 AM6/13/16
to Jacek Ziora, Repo and Gerrit Discussion
did you create the database following [1] passing UTF8 encoding with option -E ?
AFAIK you can only specify the character encoding when creating a new database.
Also see [2] and [3].


-Matthias

Jacek Ziora

unread,
Jun 13, 2016, 10:02:50 AM6/13/16
to Repo and Gerrit Discussion, jacek.ad...@gmail.com
Yes, I used this commands but without -E option.

Now, when I try to create database with encoding UTF8 I've got information:
createdb: database creation failed: ERROR:  encoding "UTF8" does not match locale "en_US"
DETAIL:  The chosen LC_CTYPE setting requires encoding "LATIN1".

After changing all locale to en_US.UTF-8 result is the same.

Jacek Ziora

unread,
Jun 13, 2016, 10:26:35 AM6/13/16
to Repo and Gerrit Discussion, jacek.ad...@gmail.com
I've found this command:
initdb --locale=en_US.UTF-8

And it seems to work, encoding in database is UTF8, but my error is still the same. :(

Matthias Sohn

unread,
Jun 13, 2016, 12:33:01 PM6/13/16
to Jacek Ziora, Repo and Gerrit Discussion
did you try to set both --locale and -E

createdb -E=UTF8 --locale=en_US.UTF-8

there are also more options to also set LC_COLLATE and LC_CTYPE explicitly.

If you don't set LC_COLLATE and LC_CTYPE explicitly they are taken from the environment.
Run

$ locale

to check which locale settings you are using on OS level. So maybe you are trying to use
a UTF8 locale but LC_CTYPE is set to LATIN1

-Matthias

Jacek Ziora

unread,
Jun 15, 2016, 7:48:17 AM6/15/16
to Repo and Gerrit Discussion, jacek.ad...@gmail.com
Thanks Matthias!

I've set all LCs to en_US.UTF-8 and create new database as you wrote using both parameters and it works!

Best regards,
Jacek Ziora
Reply all
Reply to author
Forward
0 new messages