【发布时间】:2019-09-03 06:44:10
【问题描述】:
我尝试使用 psql 将特殊字符“†”添加到 varchar 字段,但没有成功。在 php 应用程序中它可以工作(php 用户为 iso8859-1)。
db 的设置是:
encoding = LATIN1
collation = fi_FI
character type = fi_FI
client both UTF8 & LATIN1 (on commandline PGCLIENTENCODING=LATIN1 or PGCLIENTENCODING=UTF8)
从表格中选择 当客户端是 UTF8 时显示
locationx \u0086
如何将值从 psql 添加到数据库?以下都不起作用。
update tablex set field1 = 'locationY' || '†'
update tablex set field1 = 'locationY' || U&'\86'
给出错误信息。
ERROR: character with byte sequence 0xe2 0x80 0xa0 in encoding "UTF8" has no equivalent in encoding "LATIN1"
ERROR: invalid Unicode escape value at or near "\86' "
如果我查看我的PHP应用程序输入的数据,字节是\x6c6f636174696f6e5986,但是当我用psql输入数据时,字节是\x6c6f636174696f6e59e280a0。
【问题讨论】:
标签: php postgresql character-encoding psql