special-characters

How to convert special characters to normal characters?

拥有回忆 提交于 2019-11-28 00:04:39
I am trying to convert characters like: ë, ä, ï, ö, etc. To normal characters like: e, a, i, o, etc. What is the best way to do this? I've tried many things, like preg_replace and str_replace. Can someone help me out? -- EDIT -- What I tried, was: $ts = array("[À-Å]","Æ","Ç","[È-Ë]","/[Ì-Ï]/","/Ð/","/Ñ/","/[Ò-ÖØ]/","/×/","/[Ù-Ü]/","/[Ý-ß]/","/[à-å]/","/æ/","/ç/","/[è-ë]/","/[ì-ï]/","/ð/","/ñ/","/[ò-öø]/","/÷/","/[ù-ü]/","/[ý-ÿ]/"); $tn = array("A","AE","C","E","I","D","N","O","X","U","Y","a","ae","c","e","i","d","n","o","x","u","y"); $title = preg_replace($ts, $tn, $text); Stewie try this ..

What's the ASCII character code for '—'?

流过昼夜 提交于 2019-11-27 23:21:39
问题 I am working on decoding text. I am trying to find the character code for the — character, not to be mistaken for - , in ASCII. I have tried unsuccessfully. Does anybody know how to convert it? 回答1: Quotation from wiki (Em dash) When an actual em dash is unavailable—as in the ASCII character set—a double ("--") or triple hyphen-minus ("---") is used. In Unicode, the em dash is U+2014 (decimal 8212). Em dash character is not a part of ASCII character set. 回答2: — is known as an Em Dash. It's

How to find special characters in DB2?

我怕爱的太早我们不能终老 提交于 2019-11-27 23:14:29
I have a DB2 database containing millions of records. I found that some char() or varchar() fields contain special characters which shouldn't be stored. I guess application received broken data or some code made it. Anyway, I want to find records that have these broken data, which are special characters (not alphabetic). I tried to find the way using query but couldn't. Does someone know the good query or advice? You can use the DB2 TRANSLATE() function to isolate non-alphanumeric characters. Note that this will not work in the Oracle compatibility mode, because in that case DB2 will treat

Regular Expression To Anglicize String Characters?

强颜欢笑 提交于 2019-11-27 23:09:53
问题 Is there a common regular expression that replaces all known special characters in non-English languages: é, ô, ç, etc. with English characters: e, o, c, etc. 回答1: No, there is no such regex. Note that with a regex you "describe" a specific piece of text. A certain regex implementation might provide the possibility to do replacements using regex, but these replacements are usually only performed by a single replacement: not replace a with a' and b with b' etc. Perhaps the language you're

Eclipse character encoding

一曲冷凌霜 提交于 2019-11-27 22:59:00
I am using Scanner to scan a .txt document in Java. However, when I open the .txt document in Eclipse, I notice some characters are not being recognized, and they are replaced with something that looks like this: � These characters won't even let me scan the file as while(scan.hasNext) automatically returns false (if these characters are not present, then I can scan the document just fine). So, how do I get Eclipse to recognize these characters so I can scan? I can't manually remove them because the document is quite large. Thanks. Juned Ahsan The file you are reading must be containing UTF-8

Is there a HTML/CSS way to display HTML tags without parsing?

∥☆過路亽.° 提交于 2019-11-27 21:14:02
Is there any way that I could display HTML tags without parsing? Tags like XMP worked before perfectly but now it's replaced with PRE that isn't so cool. Take a look at this example: //This used to NOT PARSE HTML even if you used standard < and >. <XMP> <a hred="http://example.com">Link</a> </XMP> //New PRE tag requires < and > as replacement for < and >. <PRE> <a href="http://example.com">Link</A> </PRE> What I'm looking for is equivalent of old XMP tag. New PRE tag will parse code. Jukka K. Korpela You can use a script element with its type set to denote plain text, and set its display

Escape unescaped characters in XML with Python

蹲街弑〆低调 提交于 2019-11-27 18:27:32
问题 I need to escape special characters in an invalid XML file which is about 5000 lines long. Here's an example of the XML that I have to deal with: <root> <element> <name>name & surname</name> <mail>name@name.org</mail> </element> </root> Here the problem is the character "&" in the name. How would you escape special characters like this with a Python library? I didn't find a way to do it with BeautifulSoup. 回答1: If you don't care about invalid characters in the xml you could use XML parser's

Why is percentage character not escaped with backslash in C?

风流意气都作罢 提交于 2019-11-27 17:24:50
问题 The printf() documentation says that if someone wants to print % in C, he can use: printf("%%") Why is it not: printf("\%") as with other special characters? 回答1: Because the % is handled by printf . It is not a special character in C, but printf itself treats it differently. 回答2: The backslash is processed by the compiler when interpreting the source text of the program. So the common result is that the source text "\%" produces a string containing ”%”. The format string is interpreted by

json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT

梦想与她 提交于 2019-11-27 16:09:05
I have an annoying problem with a database query to mssql. If the result contains special characters like the german 'ä', I cannot use json_encode to get the result as json correctly. json_last_error return 5 which is equal to JSON_ERROR_UTF8 . I guess the database does not return the values as UTF-8 encoded. The database collection is *Latin1_General_CI_AS* and the affected columns are varchars . The php mssql.charset configuration has no effect. I read that mysql users could use mysql_query('SET CHARACTER SET utf8'); to encode the return values correctly. What can I do, to get the values

Working with GD ( imagettftext() ) and UTF-8 characters

余生长醉 提交于 2019-11-27 16:03:53
Just for the record - my first question here but hopefully not my last input in the community. But that's not why I'm here. I'm currently developing a simple system that has to generate an image with a text on it. Everthing went well until I realised that GD cannot handle UTF-8 characters like ā, č, ž, ä, ø, é and so on. To clear things up - I'm using imagettftext() Trying to solve my problem I dug into depths of google and some solutions were returned, none of them, sadly, solved my problem completely. Currently I'm using this script I found in this thread - PHP function imagettftext() and