Closed Evreke closed 6 years ago
Hi @Evreke,
You might want to try the string.recode
method:
Convert a string. Effective only if Camomile is enabled.
Type: (?in_enc:string,?out_enc:string,string)->string
Category: String
Parameters:
* in_enc : string (default: "")
Input encoding. Autodetected if empty.
* out_enc : string (default: "UTF-8")
Output encoding.
* (unlabeled) : string (default: None)
For instance, if you want to convert a string to ECMA-CYRILLIC
you would do:
s = string.recode(out_enc="ECMA-CYRILLIC",s)
Hope that helps, feel free to re-open if you have more questions or if the problem still occurs.
Although, you might want to double check on which encoding to use. I believe that the json
standard expects UTF8
strings only.
Liquidsoap is running in docker container (using my own image with Ubuntu:16.04 and regular apt install liquidsoap) I am trying to make feature for my web radio that will show last N played tracks in frontend. Decision is to use Python script which will take 2 arguments, then write\append them to json file...
I am using this part of code
My python script fails to write Cyrillic strings to json but no problem with Latin characters.
One guy from community told me to get bytes of passed string from liquidsoap to determine output encoding, but i have no success to determine encoding of bytes array.
Is there anyway to determine what type of encoding variables
artist
andtitle
have.