如何显示“不可见” psql / postgres中的unicode字符? [英] How to display "invisible" unicode characters in psql / postgres?

查看:363
本文介绍了如何显示“不可见” psql / postgres中的unicode字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从psql(postgres命令行客户端)内部显示通常不可见的unicode字符?

How can I display normally invisible unicode characters from within psql (the postgres command line client)?

推荐答案

在Postgress表中看不见的Unicode,您将要同时使用 encode和 escape。只是为了好玩,转义功能需要强制转换以键入bytea。全部放在一起:

To see otherwise invisible Unicode in a postgress table, you'll want to use "encode" and "escape" both. And just for fun, the escape function requires a cast to type bytea. Putting it all together:

# CREATE TABLE xxx_test (foo text);
# INSERT INTO xxx_test (foo) values (E'Invis\u200eble €');

# SELECT foo from xxx_test;
Invis‎ble €
# SELECT encode(foo::bytea, 'escape') FROM xxx_test;
Invis\342\200\216ble \342\202\254

# DROP TABLE xxx_test;

这篇关于如何显示“不可见” psql / postgres中的unicode字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆