Core: Telegram conversation encoding

Created on 25 May 2016  路  7Comments  路  Source: php-telegram-bot/core

Hello!

I use DB to store bot data. Today I saw this in conversation table:
image

English letters stores fine, but other looks like: \u0417\u0430. In telegram client all looks good...
In message table letters shows fine.
Is this a problem?

Most helpful comment

Fields in message table are not being json encoded, they are using database/table encoding, which usually supports cyrillic.

Json converts all UTF8 characters into escaped unicode characters. It prefers to operate on standard characters a-Z, 0-9, and basic symbols.

What is the problem anyway? When you get state data back using Conversation characters should be as they were typed.

All 7 comments

json encodes special characters into this format
But it shouldn't do that for normal letters...

It's normal letters (Russian language), not the special chars.

Russian characters are not normal characters when it comes to encoding.

In message table they are looks correct.

Fields in message table are not being json encoded, they are using database/table encoding, which usually supports cyrillic.

Json converts all UTF8 characters into escaped unicode characters. It prefers to operate on standard characters a-Z, 0-9, and basic symbols.

What is the problem anyway? When you get state data back using Conversation characters should be as they were typed.

What is the problem anyway?

Uncomfortable to watch string conversation values in the database.
Also I want to understand how it works.

@Sogl
To find out more about JSON and how it handles different data types, check here:
http://json.org/

closing here...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Zoha picture Zoha  路  3Comments

nesttle picture nesttle  路  4Comments

NabiKAZ picture NabiKAZ  路  3Comments

dorcu picture dorcu  路  3Comments

Bl0ck154 picture Bl0ck154  路  3Comments