更改 LC_CTYPE 以供 PostgreSQL 和 PostGIS 使用

发布于 2024-12-19 06:41:55 字数 363 浏览 4 评论 0原文

所以我正在浏览 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

最好是你 2024-12-26 06:41:55

最好只指定数据库的区域设置并从中计算出编码。所以使用类似的东西

createdb --locale=en_US.utf8 template_postgis

It is better to just specify the locale for the database and have the encoding be figured out from that. So use something like

createdb --locale=en_US.utf8 template_postgis
与风相奔跑 2024-12-26 06:41:55

-E UTF8 和 --locale=en_US.utf8 都是需要的

$ createdb -E UTF8 -T template0 --locale=en_US.utf8 template_postgis

Both -E UTF8 and --locale=en_US.utf8 are needed

$ createdb -E UTF8 -T template0 --locale=en_US.utf8 template_postgis
各自安好 2024-12-26 06:41:55

否则,当您登录 postgresql 时尝试以下操作:

create database databse_name with owner database_owner encoding='UTF-8'lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0;

Else, try this when you log in to postgresql :

create database databse_name with owner database_owner encoding='UTF-8'lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0;
喜爱皱眉﹌ 2024-12-26 06:41:55

您需要将操作系统的区域设置设置为任何 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 like update-locale LANG=en_US.utf8, replacing en_US.utf8 with whatever locale you want.

迷爱 2024-12-26 06:41:55

看看这个: https://askubuntu.com/questions/20880/unicode- in-postgresql-8-4/114922#114922

也许您需要在创建集群之前配置区域设置

~#export LANGUAGE=en_US.UTF-8
~#export LANG=en_US.UTF-8
~#export LC_ALL=en_US.UTF-8
~#locale-gen en_US.UTF-8
~#dpkg-reconfigure locales

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

~#export LANGUAGE=en_US.UTF-8
~#export LANG=en_US.UTF-8
~#export LC_ALL=en_US.UTF-8
~#locale-gen en_US.UTF-8
~#dpkg-reconfigure locales
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文