diacritics

Check If the string contains accented characters in SQL?

拟墨画扇 提交于 2019-11-26 23:14:35
I want to perform a task if the input string contain any accented characters else do another task in SQL. Is there any way to check this condition in SQL ? Eg: @myString1 = 'àéêöhello!' IF(@myString1 contains any accented characters) Task1 ELSE Task2 JohnLBevan SQL Fiddle: http://sqlfiddle.com/#!6/9eecb7d/1607 declare @a nvarchar(32) = 'àéêöhello!' declare @b nvarchar(32) = 'aeeohello!' select case when (cast(@a as varchar(32)) collate SQL_Latin1_General_Cp1251_CS_AS) = @a then 0 else 1 end HasSpecialChars select case when (cast(@b as varchar(32)) collate SQL_Latin1_General_Cp1251_CS_AS) = @b

Regex to ignore accents? PHP

冷暖自知 提交于 2019-11-26 21:32:39
问题 Is there anyway to make a Regex that ignores accents? For example: preg_replace("/$word/i", "<b>$word</b>", $str); The "i" in the regex is to ignore case sensitive, but is there anyway to match, for example java with Jávã ? I did try to make a copy of the $str, change the content to a no accent string and find the index of all the occurrences. But the index of the 2 strings seems to be different, even though it's just with no accents. (I did a research, but all I could found is how to remove

Easy way to remove accents from a Unicode string? [duplicate]

女生的网名这么多〃 提交于 2019-11-26 19:44:53
This question already has an answer here: Is there a way to get rid of accents and convert a whole string to regular letters? 11 answers I want to change this sentence : Et ça sera sa moitié. To : Et ca sera sa moitie. Is there an easy way to do this in Java, like I would do in Objective-C ? NSString *str = @"Et ça sera sa moitié."; NSData *data = [str dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; NSString *newStr = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding]; Rob Finally, I've solved it by using the Normalizer class. import java.text.Normalizer;

How to replace unicode characters by ascii characters in Python (perl script given)?

点点圈 提交于 2019-11-26 19:42:02
问题 I am trying to learn python and couldn't figure out how to translate the following perl script to python: #!/usr/bin/perl -w use open qw(:std :utf8); while(<>) { s/\x{00E4}/ae/; s/\x{00F6}/oe/; s/\x{00FC}/ue/; print; } The script just changes unicode umlauts to alternative ascii output. (So the complete output is in ascii.) I would be grateful for any hints. Thanks! 回答1: Use the fileinput module to loop over standard input or a list of files, decode the lines you read from UTF-8 to unicode

Test if string contains only letters (a-z + é ü ö ê å ø etc..)

泄露秘密 提交于 2019-11-26 19:23:04
问题 I want to match a string to make sure it contains only letters. I've got this and it works just fine: var onlyLetters = /^[a-zA-Z]*$/.test(myString); BUT Since I speak another language too, I need to allow all letters, not just A-Z. Also for example: é ü ö ê å ø does anyone know if there is a global 'alpha' term that includes all letters to use with regExp? Or even better, does anyone have some kind of solution? Thanks alot EDIT: Just realized that you might also wanna allow '-' and ' '

How to remove accents in MySQL?

扶醉桌前 提交于 2019-11-26 18:41:15
I've just compiled a database of 1 million place names. I'm going to use it in an auto-complete widget to look up cities. A lot of these places have accents... I want to be able to find records when a user types the name without an accent. In order to do this, I've got a 2nd column with an unaccented copy of the name. Many of these records are still blank, so I want to write a query to fill them in. Is this possible in straight MySQL? If so, how? If you set an appropriate collation for the column then the value within the field will compare equal to its unaccented equivalent naturally. mysql>

SQLite accent-insensitive search

爷,独闯天下 提交于 2019-11-26 17:50:14
问题 Is there any way to do an accent-insensitive LIKE query in SQLite? For example, this query: SELECT * FROM users WHERE name LIKE "Andre%" would return: André the Giant Andre Agassi etc. I'm using Qt with QSqlDatabase if it makes any difference. 回答1: Set up a collation using sqlite3_create_collation and then use it like this: SELECT * FROM users WHERE name LIKE "Andre%" COLLATE NOACCENTS 来源: https://stackoverflow.com/questions/14009261/sqlite-accent-insensitive-search

Python and character normalization

﹥>﹥吖頭↗ 提交于 2019-11-26 17:42:24
问题 Hello I retrieve text based utf8 data from a foreign source which contains special chars such as u"ıöüç" while I want to normalize them to English such as "ıöüç" -> "iouc" . What would be the best way to achieve this ? 回答1: I recommend using Unidecode module: >>> from unidecode import unidecode >>> unidecode(u'ıöüç') 'iouc' Note how you feed it a unicode string and it outputs a byte string. The output is guaranteed to be ASCII. 回答2: It all depends on how far you want to go in transliterating

Replacing diacritics in Javascript

断了今生、忘了曾经 提交于 2019-11-26 15:56:05
问题 How can I replace diacritics (ă,ş,ţ etc) with their "normal" form (a,s,t) in javascript? 回答1: If you want to do it entirely on the client side, I think your only option is with some kind of lookup table. Here's a starting point, written by a chap called Olavi Ivask on his blog... function replaceDiacritics(s) { var s; var diacritics =[ /[\300-\306]/g, /[\340-\346]/g, // A, a /[\310-\313]/g, /[\350-\353]/g, // E, e /[\314-\317]/g, /[\354-\357]/g, // I, i /[\322-\330]/g, /[\362-\370]/g, // O, o

Remove accents from String

一曲冷凌霜 提交于 2019-11-26 15:39:43
问题 Is there any way in Android that (to my knowledge) doesn't have java.text.Normalizer, to remove any accent from a String. E.g "éàù" becomes "eau". I'd like to avoid parsing the String to check each character if possible! 回答1: java.text.Normalizer is there in Android (on latest versions anyway). You can use it. EDIT For reference, here is how to use Normalizer : string = Normalizer.normalize(string, Normalizer.Form.NFD); string = string.replaceAll("[^\\p{ASCII}]", ""); (pasted from the link in