special-characters

How do I match accented characters in preg_match()?

谁都会走 提交于 2019-12-06 01:44:24
问题 I've read how accented characters might sometimes match [a-z]. What I'd like to know is how I could match a specific accented character. Obviously, preg_match('/[ñ]/', 'ñ') does not work. 回答1: Use the /u modifier. That will enable Unicode for the regexes. http://php.net/manual/en/reference.pcre.pattern.modifiers.php 回答2: You can take their codes and match them like \xD0 - heximal sequences if accented symbols are not accepted 来源: https://stackoverflow.com/questions/2250567/how-do-i-match

Convert special characters to normal characters using PHP, like ã, é, ç to a, e, c [closed]

拈花ヽ惹草 提交于 2019-12-06 01:34:05
I would like to convert special characters to normal characters using PHP. For example. ã, á, à, é, ç, ... to a, a, a, e, c, ... It would be great if someone could help me with the issue I'm having. $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"); preg_replace($ts,$tn, $p); Make an array of the special characters and an array of the regular

Remove weird invalid character in ruby

心不动则不痛 提交于 2019-12-06 00:26:16
I have some XML content (UTF-8), that contains invalid characters (nokogiri tells me Line 2190, SyntaxError: PCDATA invalid Char value 15 when I try to parse the content with Nokogiri::XML(content) ). The character is displayed in Sublime Text editor as a "SI": When I try to copy the character, nothing gets copied, so I can't even look it up. When I open it for example in my Atom Editor, the "SI" is not displayed. However, when I step through the characters with the right key, I have to type twice to get over the place where the "SI" character is placed. First, what kind of character is this?

Convert A Char To Keys

余生颓废 提交于 2019-12-05 22:23:05
问题 I have a special char (/ @) That I want to convert to Keys. I am currently using this : Keys k = (Keys)'/'; And while debugging, I get that k equals to : LButton | RButton | MButton | Back | Space type - System.Windows.Forms.Keys k's keycode was suppose to be 111. NOTE: The code does work for uppercase letters such as : Keys k = (Keys)'Z'; In that case, k's key code is 90, which is ok. I'm trying to find a way to convert special chars to Keys. (or to their proper key code) Trying to send keys

JSF 2.0 request.getParameter return a string with wrong encoding

╄→гoц情女王★ 提交于 2019-12-05 21:42:16
I'm writing an application in JSF 2.0 which supports many languages, among them ones with special characters. I use String value = request.getParameter("name") and POST method, the page encoding is set to UTF-8 and the app is deployed on apache tomcat 6 which has the connector set correctly to utf-8 in a server.xml file: <Connector URIEncoding="utf-8" connectionTimeout="20000" port="8088" protocol="HTTP/1.1" redirectPort="8443"/> Yes I get strange results like ä for example in place of expected special characters. What should I check next to get rid of the problem? Thanks for help and

Java regex (java.util.regex). Search for dollar sign

回眸只為那壹抹淺笑 提交于 2019-12-05 21:35:30
I have a search string. When it contains a dollar symbol, I want to capture all characters thereafter, but not include the dot, or a subsequent dollar symbol.. The latter would constitute a subsequent match. So for either of these search strings...: "/bla/$V_N.$XYZ.bla"; "/bla/$V_N.$XYZ; I would want to return: V_N XYZ If the search string contains percent symbols, I also want to return what's between the pair of % symbols. The following regex seems do the trick for that. "%([^%]*?)%"; Inferring: Start and end with a %, Have a capture group - the () have a character class containing anything

php utf-8 decode from xml returns question marks

旧时模样 提交于 2019-12-05 21:29:38
I have some problems using xml. I know this is a comon question, but the answers i found didn't fix my problem. The problem is that when I add é or ä or another special char to my xml file, with php domdocument, it saves the é as xE9 and the ä as xE4. I don't know if this is ok but when I want to show the output it shows question marks at this places. I have tried alot. Like removing and adding the encoding in de xml header in the php domdocument. I also tried using file_get_contents and use php utf-8_decode to get the xml. I tried using iso intead, but nothing solved my problem. Instead I got

Qt Mac (Re)move “Special Characters…” action in Edit menu

青春壹個敷衍的年華 提交于 2019-12-05 19:49:49
I am developing an application in Qt that rebuilds its menus very often. However, when we call clear(), and re-add the actions that we want in the menu, "Special Characters..." appears to remain in the menu. Is there any way to remove, or move this action to the bottom of the QMenu? Here is the code that rebuilds the menu: void MainWindow::initMenus(Tab* tab) { menuBar()->clear(); menuFile->clear(); menuEdit->clear(); menuSettings->clear(); menuHelp->clear(); ui_toolBar->clear(); menuBar()->addMenu(menuFile); menuBar()->addMenu(menuEdit); menuFile->addAction(actionNew); menuFile->addAction

c++ can't convert string to wstring

痞子三分冷 提交于 2019-12-05 19:33:35
I would like to convert a string variable to wstring due to some german characters that cause problem when doing a substr over the variable. The start position is falsified when any these special characters is present before it. (For instance: for "ä" size() returns 2 instead of 1) I know that the following conversion works: wstring ws = L"ä"; Since, I am trying to convert a variable, I would like to know if there is an alternative way for it such as wstring wstr = L"%s"+str //this is syntaxically wrong, but wanted sth alike Beside that, I have already tried the following example to convert

non-ASCII character declaration

橙三吉。 提交于 2019-12-05 16:40:25
I would like to store a character (in order to compare it with other characters). If I declare the variable like this : char c = 'é'; everything works well, but I get these warnings : warning: multi-character character constant [-Wmultichar] char c = 'é'; ^ ii.c:12:3: warning: overflow in implicit constant conversion [-Woverflow] char c = 'é'; I think I understand why there is these warnings, but I wonder why does it still work? And should I define it like this : int d = 'é'; although it takes more space in memory? Moreover, I also get the warning below with this declaration : warning: multi