I can’t figure it out for me.
I have a query that pulls translations of elements on a page. Thus, any number of 15 languages may appear on this page. When I start adding languages like Swedish, everything that has a character like ö
causes the whole field to return an empty string.
I checked the encoding in the table and it claims to use UTF-8
, but seeing how it does not work, I got confused.
Here is the query I'm working with:
SELECT form.form_id, elem.elem_type, elem.elem_name, elem.elem_format, elem.elem_required, trans.trans_label,` trans.trans_description, trans.trans_defaultValue, trans.trans_other, elem.elem_advancedcommand FROM events_form form LEFT JOIN events_form_elements elem ON form.event_id = elem.event_id INNER JOIN events_form_translations trans ON elem.elem_id = trans.elem_id INNER JOIN events_form_languages lang ON trans.lang_id = lang.lang_id WHERE form.form_id = '{$formid}' AND lang.language = '{$language}' ORDER BY elem.elem_sortorder
Now I tried to do something like:
CONVERT(CAST(trans.trans_description as BINARY) USING latin1) as trans_description,
To make it hide the encoding, but this does not give a result at all.
After receiving the result, it is immediately json_encoded and returned to the user (Ajax Request). I DO NOT think json_encode, since the same problems occur when executing print_r
output array.
Also, finally, the system I'm building on is using xPDO, so I'm not too sure what the problem is either.
EDIT: It seems that PHP is returning the correct value or at least the value, for example, this is print_r
dump:
[trans_label] => Ditt f rnamn? [trans_description] => [trans_defaultValue] => First Name
So it seems that when my json_encode touches this string, this is when it turns the string to zero.