Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>LEFT(str, 1)</code> is supposed to the leftmost <em>character</em>, not the leftmost <em>byte</em>. This means the query is doing what you want, even if the first character is a multibyte character.</p> <p>I'm guessing the � sign emerges later, due to a connection/encoding/font/rendering problem. Try</p> <pre><code>SELECT LENGTH(LEFT(T1.Name, 1)) AS charLength </code></pre> <p>LENGTH returns how many <strong>bytes</strong> a string takes up, so if this query gives you any results of 2 or more, this means that <code>LEFT()</code> is indeed returning multibyte characters and your problem lies beyond the query itself.</p> <p>If you are executing the query at the command line, maybe your terminal cannot render the characters, or otherwise they are getting mangled somewhere else. If you are using a scripting language, try to use that language's string length, and <code>ord()</code> functions, to help find out what's going on.</p> <p>EDIT: Since you are using PHP, try this:</p> <pre><code>//Store a character returned from the database in $unicodechar $unicodechar = $row[0]; //Now print out the value of each byte in the character for($i = 0; $i &lt; strlen($unicodechar); $i++) { echo '0x' . dechex(ord($char[$i])) . ' '; } echo '\n'; </code></pre> <p>If for example the result is <a href="http://www.fileformat.info/info/unicode/char/011e/index.htm" rel="nofollow noreferrer">this character</a> then you should get "0xC4 0x9E". If you do indeed get this kind of thing, then PHP is getting the multibyte character properly, and the problem is either in the encoding of the web page itself (see <a href="http://www.w3.org/International/O-charset" rel="nofollow noreferrer">this W3C page</a>) or the browser/font cannot render that particular character.</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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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