Note that there are some explanatory texts on larger screens.

plurals
  1. POMySQL European Characters
    primarykey
    data
    text
    <p>I can't figure this out for the life of me.</p> <p>I have a query that pulls translations of elements on a page. So any number of 15 languages can appear on that page. When I start to add languages like Swedish anything that has a symbol such as <code>ö</code> results in the whole field returning a null string.</p> <p>I've verified the encoding on the table and it claims it's using <code>UTF-8</code> but seeing as how this doesn't work I'm confused.</p> <p>Here is the query I'm working with:</p> <pre><code>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 </code></pre> <p>Now I tried to do something like:</p> <p><code>CONVERT(CAST(trans.trans_description as BINARY) USING latin1) as trans_description,</code></p> <p>To force it to covert the encoding but that doesn't yield a result at all.</p> <p>After I get the result it's immediately json_encoded and returned to the user (Ajax Request). I DON'T think it's the json_encode as doing a <code>print_r</code> of the output array yields the same issues.</p> <p>Also.. lastly, the system I'm building on is using xPDO so I'm not too sure if that's the issue either.</p> <p>EDIT: It seems that PHP IS returning a correct value or at least a value for example here is a <code>print_r</code> dump:</p> <pre><code>[trans_label] =&gt; Ditt f�rnamn? [trans_description] =&gt; [trans_defaultValue] =&gt; First Name </code></pre> <p>So it seems that when my json_encode touches that string is when it turns the string to null.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload