M
M
mmind2021-02-10 22:10:30
PostgreSQL
mmind, 2021-02-10 22:10:30

How to save emoji?

I write json , where one of its fields contains emoji, in the base field with type json , gives such an error

DETAIL: Escape sequence "�" is invalid.

How can I write it down there? Looks like it's only UTF-8.
Are there any workarounds?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Melkij, 2021-02-10
@melkij

melkij=> select jsonb '"\ud83d\ude00"';
 jsonb 
-------
 ""
(1 строка)

melkij=> select json_build_object('emoji','');
 json_build_object 
-------------------
 {"emoji" : ""}

no problem. Check what exactly you are sending. Maybe the base is right and your escape sequence is invalid?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question