<?xml version="1.0" encoding="UTF-8"?>
<ticket>
  <assigned-user-id type="integer" nil="true"></assigned-user-id>
  <attachments-count type="integer">1</attachments-count>
  <closed type="boolean">true</closed>
  <created-at type="datetime">2008-08-29T11:50:02+01:00</created-at>
  <creator-id type="integer">8163</creator-id>
  <milestone-due-on type="datetime" nil="true"></milestone-due-on>
  <milestone-id type="integer">9903</milestone-id>
  <number type="integer">932</number>
  <permalink>validates_uniqueness_of-is-unicode-unaware</permalink>
  <priority type="integer">382</priority>
  <project-id type="integer">8994</project-id>
  <raw-data type="binary" nil="true" encoding="base64"></raw-data>
  <state>resolved</state>
  <tag>activerecord bug patch tiny</tag>
  <title>validates_uniqueness_of is unicode unaware</title>
  <updated-at type="datetime">2008-08-29T20:01:53+01:00</updated-at>
  <user-id type="integer">17393</user-id>
  <user-name>Repository</user-name>
  <creator-name>Eugene Pimenov</creator-name>
  <url>http://rails.lighthouseapp.com/projects/8994/tickets/932</url>
  <milestone-title>2.x</milestone-title>
  <original-body>Validate_uniqueness in case insensitive mode use downcase which is unicode-unaware. With an unicode aware database, lower(field) != downcased value so it fails to validate anything.

The patch is a simple one-liner.

In the test &#8220;Topic.find(t_utf8, :select =&gt; 'LOWER(title) AS title').title == &quot;&#1103; &#1090;&#1086;&#1078;&#1077; &#1091;&#1085;&#1080;&#1082;&#1072;&#1083;&#1100;&#1085;&#1099;&#1081;!&quot;&#8221; checks unicode awareness of database. For example, In MySQL &#8220;alter database activerecord_unittest charset=utf8&#8221; make this condition true, and &#8220;alter database activerecord_unittest charset=latin1&#8221; make it false.</original-body>
  <latest-body>Validate_uniqueness in case insensitive mode use downcase which is unicode-unaware. With an unicode aware database, lower(field) != downcased value so it fails to validate anything.

The patch is a simple one-liner.

In the test &#8220;Topic.find(t_utf8, :select =&gt; 'LOWER(title) AS title').title == &quot;&#1103; &#1090;&#1086;&#1078;&#1077; &#1091;&#1085;&#1080;&#1082;&#1072;&#1083;&#1100;&#1085;&#1099;&#1081;!&quot;&#8221; checks unicode awareness of database. For example, In MySQL &#8220;alter database activerecord_unittest charset=utf8&#8221; make this condition true, and &#8220;alter database activerecord_unittest charset=latin1&#8221; make it false.</latest-body>
  <original-body-html>&lt;div&gt;&lt;p&gt;Validate_uniqueness in case insensitive mode use downcase which
is unicode-unaware. With an unicode aware database, lower(field) !=
downcased value so it fails to validate anything.&lt;/p&gt;
&lt;p&gt;The patch is a simple one-liner.&lt;/p&gt;
&lt;p&gt;In the test &amp;acirc;&amp;#8364;&amp;#339;Topic.find(t_utf8, :select =&amp;gt;
'LOWER(title) AS title').title == &quot;&amp;Ntilde;
&amp;Ntilde;&amp;#8218;&amp;ETH;&amp;frac34;&amp;ETH;&amp;para;&amp;ETH;&amp;micro;
&amp;Ntilde;&amp;#402;&amp;ETH;&amp;frac12;&amp;ETH;&amp;cedil;&amp;ETH;&amp;ordm;&amp;ETH;&amp;deg;&amp;ETH;&amp;raquo;&amp;Ntilde;&amp;#338;&amp;ETH;&amp;frac12;&amp;Ntilde;&amp;#8249;&amp;ETH;&amp;sup1;!&quot;&amp;acirc;&amp;#8364;
checks unicode awareness of database. For example, In MySQL
&amp;acirc;&amp;#8364;&amp;#339;alter database activerecord_unittest
charset=utf8&amp;acirc;&amp;#8364; make this condition true, and
&amp;acirc;&amp;#8364;&amp;#339;alter database activerecord_unittest
charset=latin1&amp;acirc;&amp;#8364; make it false.&lt;/p&gt;&lt;/div&gt;</original-body-html>
  <versions type="array">
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Validate_uniqueness in case insensitive mode use downcase which is unicode-unaware. With an unicode aware database, lower(field) != downcased value so it fails to validate anything.

The patch is a simple one-liner.

In the test &#8220;Topic.find(t_utf8, :select =&gt; 'LOWER(title) AS title').title == &quot;&#1103; &#1090;&#1086;&#1078;&#1077; &#1091;&#1085;&#1080;&#1082;&#1072;&#1083;&#1100;&#1085;&#1099;&#1081;!&quot;&#8221; checks unicode awareness of database. For example, In MySQL &#8220;alter database activerecord_unittest charset=utf8&#8221; make this condition true, and &#8220;alter database activerecord_unittest charset=latin1&#8221; make it false.</body>
      <body-html>&lt;div&gt;&lt;p&gt;Validate_uniqueness in case insensitive mode use downcase which
is unicode-unaware. With an unicode aware database, lower(field) !=
downcased value so it fails to validate anything.&lt;/p&gt;
&lt;p&gt;The patch is a simple one-liner.&lt;/p&gt;
&lt;p&gt;In the test &amp;#8220;Topic.find(t_utf8, :select =&amp;gt;
'LOWER(title) AS title').title == &quot;&amp;#1103;
&amp;#1090;&amp;#1086;&amp;#1078;&amp;#1077;
&amp;#1091;&amp;#1085;&amp;#1080;&amp;#1082;&amp;#1072;&amp;#1083;&amp;#1100;&amp;#1085;&amp;#1099;&amp;#1081;!&quot;&amp;#8221;
checks unicode awareness of database. For example, In MySQL
&amp;#8220;alter database activerecord_unittest charset=utf8&amp;#8221;
make this condition true, and &amp;#8220;alter database
activerecord_unittest charset=latin1&amp;#8221; make it false.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-08-29T11:50:04+01:00</created-at>
      <creator-id type="integer">8163</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">932</number>
      <permalink>validates_uniqueness_of-is-unicode-unaware</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>activerecord bug patch tiny</tag>
      <title>validates_uniqueness_of is unicode unaware</title>
      <updated-at type="datetime">2008-08-29T11:50:04+01:00</updated-at>
      <user-id type="integer">8163</user-id>
      <user-name>Eugene Pimenov</user-name>
      <creator-name>Eugene Pimenov</creator-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/932</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>Nice!
+1</body>
      <body-html>&lt;div&gt;&lt;p&gt;Nice! +1&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-08-29T13:40:10+01:00</created-at>
      <creator-id type="integer">8163</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">932</number>
      <permalink>validates_uniqueness_of-is-unicode-unaware-2</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>new</state>
      <tag>activerecord bug patch tiny</tag>
      <title>validates_uniqueness_of is unicode unaware</title>
      <updated-at type="datetime">2008-08-29T13:40:10+01:00</updated-at>
      <user-id type="integer">19965</user-id>
      <user-name>Jos&#233; Valim</user-name>
      <creator-name>Eugene Pimenov</creator-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/932</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>http://github.com/rails/rails/commit/743f0e7114b071bf7786a80227c12dcc7ccee6c1</body>
      <body-html>&lt;div&gt;&lt;p&gt;&lt;a href=&quot;http://github.com/rails/rails/commit/743f0e7114b071bf7786a80227c12dcc7ccee6c1&quot;&gt;
http://github.com/rails/rails/co...&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2008-08-29T19:49:16+01:00</created-at>
      <creator-id type="integer">8163</creator-id>
      <diffable-attributes type="yaml">--- 
:state: new
</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">932</number>
      <permalink>validates_uniqueness_of-is-unicode-unaware-3</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>resolved</state>
      <tag>activerecord bug patch tiny</tag>
      <title>validates_uniqueness_of is unicode unaware</title>
      <updated-at type="datetime">2008-08-29T19:49:16+01:00</updated-at>
      <user-id type="integer">14890</user-id>
      <user-name>Tarmo T&#228;nav</user-name>
      <creator-name>Eugene Pimenov</creator-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/932</url>
      <milestone-title>2.x</milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>(from [184ae2ccb49f0e408fe7d9ba7fe2d1bc5470bc8a]) Make case insensitive validates_uniqueness_of use unicode aware downcase method. [#932 state:resolved]

Signed-off-by: Michael Koziarski &lt;michael@koziarski.com&gt;

Conflicts:

	activerecord/lib/active_record/validations.rb

Signed-off-by: Tarmo T&#228;nav &lt;tarmo@itech.ee&gt;
http://github.com/rails/rails/commit/184ae2ccb49f0e408fe7d9ba7fe2d1bc5470bc8a</body>
      <body-html>&lt;div&gt;&lt;p&gt;(from [184ae2ccb49f0e408fe7d9ba7fe2d1bc5470bc8a]) Make case
insensitive validates_uniqueness_of use unicode aware downcase
method. [&lt;a href=&quot;/projects/8994/tickets/932&quot; title=&quot;Ticket #932&quot;&gt;#932&lt;/a&gt; state:resolved]&lt;/p&gt;
&lt;p&gt;Signed-off-by: Michael Koziarski &lt;a href=&quot;mailto:michael@koziarski.com&quot;&gt;michael@koziarski.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Conflicts:&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;activerecord/lib/active_record/validations.rb
&lt;/code&gt;
&lt;/pre&gt;
&lt;p&gt;Signed-off-by: Tarmo T&amp;auml;nav &lt;a href=&quot;mailto:tarmo@itech.ee&quot;&gt;tarmo@itech.ee&lt;/a&gt; &lt;a href=&quot;http://github.com/rails/rails/commit/184ae2ccb49f0e408fe7d9ba7fe2d1bc5470bc8a&quot;&gt;
http://github.com/rails/rails/co...&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2008-08-29T20:01:53+01:00</created-at>
      <creator-id type="integer">8163</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer">9903</milestone-id>
      <number type="integer">932</number>
      <permalink>validates_uniqueness_of-is-unicode-unaware-4</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">8994</project-id>
      <state>resolved</state>
      <tag>activerecord bug patch tiny</tag>
      <title>validates_uniqueness_of is unicode unaware</title>
      <updated-at type="datetime">2008-08-29T20:01:53+01:00</updated-at>
      <user-id type="integer">17393</user-id>
      <user-name>Repository</user-name>
      <creator-name>Eugene Pimenov</creator-name>
      <url>http://rails.lighthouseapp.com/projects/8994/tickets/932</url>
      <milestone-title>2.x</milestone-title>
    </version>
  </versions>
  <attachments type="array">
    <attachment type="Attachment">
      <code>b309e10548677614a3ff3ffa3552a428aa0c7ea8</code>
      <content-type>text/plain</content-type>
      <created-at type="datetime">2008-08-29T11:50:04+01:00</created-at>
      <filename>0001-Make-case-insensitive-validates_uniqueness_of-use-un.patch</filename>
      <height type="integer" nil="true"></height>
      <id type="integer">42497</id>
      <size type="integer">2050</size>
      <uploader-id type="integer">8163</uploader-id>
      <width type="integer" nil="true"></width>
      <url>http://rails.lighthouseapp.com/attachments/42497/0001-Make-case-insensitive-validates_uniqueness_of-use-un.patch</url>
    </attachment>
  </attachments>
</ticket>
