<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>jDowdle.com &#187; MySQL</title>
	<atom:link href="http://jdowdle.com/wp/category/code/mysql-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://jdowdle.com/wp</link>
	<description></description>
	<lastBuildDate>Mon, 06 Feb 2012 03:31:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Finding international characters with MySQL</title>
		<link>http://jdowdle.com/wp/2009/08/finding-international-characters-with-mysql/</link>
		<comments>http://jdowdle.com/wp/2009/08/finding-international-characters-with-mysql/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 17:10:37 +0000</pubDate>
		<dc:creator>Jon Dowdle</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[MySql]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://jdowdle.com/wp/?p=346</guid>
		<description><![CDATA[I recently had to find the rows in a database that contained any multibyte characters. My first thought was to leverage the difference between length() and char_length(). The query would be similiar to this: Select pKey, dataCol From myTable Where length(dataCol) != char_length(dataCol) To my surprise this query didn't work. After mulling it over in [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had to find the rows in a database that contained any multibyte characters. My first thought was to leverage the difference between length() and char_length(). The query would be similiar to this:</p>
<pre>Select pKey, dataCol
From myTable
Where length(dataCol) != char_length(dataCol)</pre>
<p>To my surprise this query didn't work. After mulling it over in my mind, I tried a few debugging statements such as:</p>
<pre>Select pKey,
  dataCol,
  length(dataCol),
  char_length(dataCol)
From myTable</pre>
<p>That only reaffirmed that all return values of the char_length() were equal to the length() results.</p>
<p>Then it hit me, I (or rather the database) was using the latin1 character set. So I quickly cast the data into utf8 and it worked! Below is the resulting query.</p>
<pre>Select pKey, dataCol
From myTable
Where length( cast(dataCol <strong>using utf8</strong>) ) !=
        char_length( cast(dataCol <strong>using utf8</strong>) )</pre>
]]></content:encoded>
			<wfw:commentRss>http://jdowdle.com/wp/2009/08/finding-international-characters-with-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

