I have to work with an old XML-RPC ‘protocol’ which can be used to make requests.
In my case, I want to push data via the XML-RPC ‘protocol’ to my customer.
Everything works, however there is one problem:


For the request to send special characters properly, the files have to be encoded in ISO 8859-1. I did this and whenever I indicate a variable directly in the file, such as:
$variable = “all special characters included: äöüß”;
my customer receives the special characters properly.
However, when I access the data directly from a DB (MySql-DB), the special characters are not displayed properly on my customer’s side. When I echo out the data from the DB on my side, however, the special characters are displayed just fine.
Question: Why does the script send special characters properly when they are directly indicated in the file ($variable = “all special characters included: äöüß”;) but not when I pull the exact same string from the DB and send it? Can I encode the variables as well? Is there something I can do?
Is your database table/column also latin1 encoded or something different like utf8/utf8mb4? If so take a look at utf8encode/decode function in php 🙂
Quick and nice fix. Thx very much! Should have figured this one out myself.
The encoding of your php-file, of your database table and the page of your client (meta charset) must match to show the same characters properly. When that is not the case then fix the database DEFAULT CHARACTER SET first, if that is possible, or use decode and encode.


My columns definitely have the proper ISO format. Also my files. I’m not sure about the DB as a whole. Ran a couple of queries but not sure if they took effect.
The decode/encode functions work perfectly though, although it’s not very beautiful.
Members
Online

source