Answer the question
In order to leave comments, you need to log in
How to set up correct Cyrillic output via IDHTTP?
Business in what:
I Use IdHTTP for return of values on the server (XE8). When saving to the database, question marks are saved instead of Cyrillic characters.
1. Using AnsiToUtf8 (and similar ones) does nothing at all.
2. Using URLEncode (various variations) makes the string look like "%0F%0E%0B%0D%00%0F" but saves all sorts of nonsense in the database
2.5 Using the standard TIdURI.URLEncode makes the string look like "%0F%0E%0B% 0D%00%0F", and writes it to the database.
3. Using UTF8String is impossible when building the Android version of the application, but it also does not lead to anything, question marks remain.
4. Using WriteString when preparing a request (together with Post) changes the final value in the database, but Russian letters do not appear (option aoaeoaae). Remarkably, outputting data using WriteString works great.
5. When using StringStream and StringList, the result is similar to that of WriteString.
My server, so it is possible to change the encoding on the server. At the moment, the encoding on the server is UTF-8, on the intermediate file - UTF-8 without BOM.
What to do? How to deliver the Cyrillic alphabet to the database in the simplest way?
PS The issue is resolved: The version with TIdURI.URLEncode and rawurldecode() works on the server with PHP.
Answer the question
In order to leave comments, you need to log in
That is, you have a problem in the database connection about which there is not a word. Delivering Cyrillic in the simplest way is to set up the correct connection to the database. As a result, for all character fields, you should create descendants of TWideStringField or its analogue. Check your database connection settings. If the base is Interbase/Firebird, then it is sufficient to specify UTF8 in the connection parameter.
If you still have an ANSII-encoded base and a connection to it, then in the text field methods in the Get/PutRecord events, you need to use processing by the utf8encode/utf8decode methods.
Using AnsiToUtf8 (and similar ones) does nothing at all.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question