collation

Case sensitive search in Django, but ignored in Mysql

让人想犯罪 __ 提交于 2021-01-21 08:17:39
问题 I have a field in a Django Model for storing a unique (hash) value. Turns out that the database (MySQL/inno) doesn't do a case sensitive search on this type (VARCHAR), not even if I explicitly tell Django to do a case sensitive search Document.objects.get(hash__exact="abcd123") . So "abcd123" and "ABcd123" are both returned, which I don't want. class document(models.Model): filename = models.CharField(max_length=120) hash = models.CharField(max_length=33 ) I can change the 'hash field' to a

Case sensitive search in Django, but ignored in Mysql

强颜欢笑 提交于 2021-01-21 08:16:32
问题 I have a field in a Django Model for storing a unique (hash) value. Turns out that the database (MySQL/inno) doesn't do a case sensitive search on this type (VARCHAR), not even if I explicitly tell Django to do a case sensitive search Document.objects.get(hash__exact="abcd123") . So "abcd123" and "ABcd123" are both returned, which I don't want. class document(models.Model): filename = models.CharField(max_length=120) hash = models.CharField(max_length=33 ) I can change the 'hash field' to a

How to sort a collection of UTF-8 strings containing non-Latin chars in Laravel 5.3?

假如想象 提交于 2020-07-08 13:04:42
问题 Folks, I want to sort following nested collection by string alphabeticaly : $collection = collect([ ["name"=>"maroon"], ["name"=>"zoo"], ["name"=>"ábel"], ["name"=>"élof"] ])->sortBy("name"); I would expect : 1=> "ábel" 2=> "élof" 3=> "maroon" 4=> "zoo" I got instead : 1=> "maroon" 2=> "zoo" 3=> "ábel" 4=> "élof" I seen some PHP threads for this, but I am curious if there is any Laravel workaround for this. Thanks. 回答1: Here's a Solid way to do it: $blank = array(); $collection = collect([ [

Rails 3: Change charset and collation of an existing mysql database

◇◆丶佛笑我妖孽 提交于 2020-05-29 09:05:18
问题 Is it possible to change the charset and collation of an existing Mysql database using Rails migrations or other options ?! What's the best way to initially configure database charset & collation ?! 回答1: For latest version of Rails you can use this gist: Change charset and collation of an existing mysql Modified from here: 回答2: Native query could be executed in rails migration: def self.up execute "ALTER DATABASE `#{ActiveRecord::Base.connection.current_database}` CHARACTER SET charset_here

why does my html not display special characters taken from my database

懵懂的女人 提交于 2020-05-08 14:54:05
问题 I included this at the top of my php file: <?php header('Content-Type: text/html; charset=UTF-8'); ?> I did this because my file.php was not displaying "á, é, í, ó, ú or ¿" in the html file or from data queried from my database. After I placed the 'header('Content-Type: text/html; charset=UTF-8');' line of code my html page started to understand the special characters in the html file but, data received from my database now has a black rhombus with a question mark. The collation my database

Change instance level collation of SQL Server using powershell

泄露秘密 提交于 2020-02-07 05:17:26
问题 I want to change the collation of SQL Server instance programmatically using powershell script. Followings are the manual steps: Stop the SQL Server instance Go to directory location: "C:\Program Files\Microsoft SQL Server\MSSQL14.SQL2017\MSSQL\Binn" Execute following command: sqlservr -c -m -T4022 -T3659 -s"SQL2017" -q"SQL_Latin1_General_CP1_CI_AS" After the execution of the above command, following message displayed: "The default collation was successfully changed." Then I need to press

Change instance level collation of SQL Server using powershell

给你一囗甜甜゛ 提交于 2020-02-07 05:16:26
问题 I want to change the collation of SQL Server instance programmatically using powershell script. Followings are the manual steps: Stop the SQL Server instance Go to directory location: "C:\Program Files\Microsoft SQL Server\MSSQL14.SQL2017\MSSQL\Binn" Execute following command: sqlservr -c -m -T4022 -T3659 -s"SQL2017" -q"SQL_Latin1_General_CP1_CI_AS" After the execution of the above command, following message displayed: "The default collation was successfully changed." Then I need to press

Normalize All UTF8 Character into it's most standard format

做~自己de王妃 提交于 2020-01-30 06:33:26
问题 I used this code: Public Function RemoveDiacritics(ByVal s As String) As String Dim normalizedString As String Dim stringBuilder As New StringBuilder normalizedString = s.Normalize(NormalizationForm.FormKD) Dim i As Integer Dim c As Char For i = 0 To normalizedString.Length - 1 c = normalizedString(i) If CharUnicodeInfo.GetUnicodeCategory(c) <> UnicodeCategory.NonSpacingMark Then stringBuilder.Append(c) End If Next Return stringBuilder.ToString() End Function This awesome function work MOST

Java array sort UTF-8

主宰稳场 提交于 2020-01-29 04:21:12
问题 I want to sort an ArrayList<String> but the problem is my native language characters - my alphabet is like this: a, ą, b, c, č, d, e, f ... z, ž . As you see z character is second from the end and ą is second in alphabet, so after I sort my array it is sorted incorrectly. All my native language characters are moved to the end of array. Example: package lt; import java.util.ArrayList; import java.util.Collections; public class test { public static void main(String[] args) { List<String> items