更改 LC_CTYPE 以供 PostgreSQL 和 PostGIS 使用
所以我正在浏览 GeoDjango 教程,但我被这个错误消息困住了:
postgres@lucid32:~$ createdb -E UTF8 template_postgis
createdb: database creation failed: ERROR: encoding UTF8 does not match locale en_US
DETAIL: The chosen LC_CTYPE setting requires encoding LATIN1.
我用谷歌搜索并阅读了一些 Ubuntu 文档,但无济于事。任何见解将不胜感激!
我使用默认的 Vagrant Box lucid 32 来测试我的设置。
So I'm walking through the GeoDjango tutorial and I'm stuck on this error message:
postgres@lucid32:~$ createdb -E UTF8 template_postgis
createdb: database creation failed: ERROR: encoding UTF8 does not match locale en_US
DETAIL: The chosen LC_CTYPE setting requires encoding LATIN1.
I've googled and read some Ubuntu docs but to no avail. Any insight would be greatly appreciated!
I'm using the default Vagrant Box lucid 32, for testing out my setup.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
最好只指定数据库的区域设置并从中计算出编码。所以使用类似的东西
It is better to just specify the locale for the database and have the encoding be figured out from that. So use something like
-E UTF8 和 --locale=en_US.utf8 都是需要的
Both -E UTF8 and --locale=en_US.utf8 are needed
否则,当您登录 postgresql 时尝试以下操作:
Else, try this when you log in to postgresql :
您需要将操作系统的区域设置设置为任何 utf8 兼容的区域设置。运行
locale -a
获取可以使用的区域设置列表,然后执行update-locale LANG=en_US.utf8
之类的操作,将 en_US.utf8 替换为您可以使用的任何区域设置想。You need to set your operating system's locale to any utf8 compatible locale. Run
locale -a
to get a list of locales you can use, and then do something likeupdate-locale LANG=en_US.utf8
, replacing en_US.utf8 with whatever locale you want.看看这个: https://askubuntu.com/questions/20880/unicode- in-postgresql-8-4/114922#114922
也许您需要在创建集群之前配置区域设置
look at this: https://askubuntu.com/questions/20880/unicode-in-postgresql-8-4/114922#114922
maybe you need configure the locale before to create the cluster