Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What type should I use to store emoji in PostgreSQL?

I am working with Postgres and newbie too,

I have to store the user's comment (like facebook comment) into database. probably I will use column type "text" to store the comment.

If in case the comment is mixed up with emojis (unicode), the text type is enough or I should use any other column type?

like image 924
karthik Avatar asked Mar 24 '16 11:03

karthik


People also ask

Does PostgreSQL support emoji?

emoji is a pure SQL PostgreSQL extension to encode/decode bytea/text to/from emoji. A lookup-table is constructed from the first 1024 emojis from [https://unicode.org/Public/emoji/13.1/emoji-test.txt], where each emoji maps to a unique 10 bit sequence.

What data type is emoji?

Emojis look like images, or icons, but they are not. They are letters (characters) from the UTF-8 (Unicode) character set.

How can I store emojis in DB?

Use urlEncoder to encode your String having emoticons. Store it in DB without altering the MysqlDB. You can store it in solr core(decoded form)if you want or you can store encoded form.

What encoding is used for emojis?

The Unicode Standard has assigned numbers to represent emojis. Here's how it works. In the Unicode Standard, each emoji is represented as a "code point" (a hexadecimal number) that looks like U+1F063, for example.


1 Answers

The TEXT "character" type should be fine as UTF-8, generally, is a supported character set.

like image 150
Anthony Mastrean Avatar answered Oct 18 '22 09:10

Anthony Mastrean