special-characters

htmlentities with exceptions

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-11 10:05:21
问题 I have some set of possible tags for example "<main>", "<text>", "<tag>" . Rest of characters I would like to treat with htmlentities (htmlspecialchars) <main> <text> <tag> <> X&Y < <falsetag> <tag attr="123" /> </tag> </text> </main> The result should be <main> <text> <tag> <> X&Y < <falsetag> <tag attr="123" /> </tag> </text> </main> What's the best way to do it. 回答1: You can run htmlentities on the text then use a regular expression to replace the allowed tags <> Example... $str = '<main>

What is the difference between %*c%c and %c as a format specifier to scanf?

元气小坏坏 提交于 2020-01-11 09:16:22
问题 I typically acquire a character with %c , but I have seen code that used %*c%c . For example: char a; scanf("%*c%c", &a); What is the difference? 回答1: In a scanf format string, after the % , the * character is the assignment-suppressing character . In your example, it eats the first character but does not store it. For example, with: char a; scanf("%c", &a); If you enter: xyz\n , ( \n is the new line character) then x will be stored in object a . With: scanf("%*c%c", &a); If you enter: xyz\n

Replace symbol “%” with word “Percent”

梦想与她 提交于 2020-01-11 03:15:05
问题 How to replace symbol "%" with a word "Percent". My original string is "Internal (%) External (%)". The string should be "Internal (Percent) External (Percent)" Using regular expression, how I can replace this symbol? Thanks in advance. Atul 回答1: You don't need a Regex here, you can use a regular replace. For example using .net: string s = "Internal (%) External (%)"; s = s.Replace("%", "Percent"); 回答2: the match string will simply be a percent symbol: % However, implementing is specific to

Meaning of $? (dollar question mark) in shell scripts

烈酒焚心 提交于 2020-01-08 17:25:30
问题 What does echo $? mean in shell programming? 回答1: This is the exit status of the last executed command. For example the command true always returns a status of 0 and false always returns a status of 1 : true echo $? # echoes 0 false echo $? # echoes 1 From the manual: (acessible by calling man bash in your shell) $? Expands to the exit status of the most recently executed foreground pipeline. By convention an exit status of 0 means success, and non-zero return status means failure. Learn more

Characters allowed in GET parameter

寵の児 提交于 2020-01-08 11:25:42
问题 Which characters are allowed in GET parameters without encoding or escaping them? I mean something like this: http://www.example.org/page.php?name=XYZ What can you have there instead of XYZ? I think only the following characters: a-z (A-Z) 0-9 - _ Is this the full list or are there additional characters allowed? I hope you can help me. Thanks in advance! 回答1: There are reserved characters , that have a reserved meanings, those are delimiters — :/?#[]@ — and subdelimiters — !$&'()*+,;= There

Forbidden You don't have permission to access on searching a special character

别说谁变了你拦得住时间么 提交于 2020-01-07 03:36:06
问题 I am supporting a java application which has a search bar which matches the keywords and gets the results from the cache. The application runs in Tomcat and has a Apache web server too. There is an issue while searching aaa' the special character ' is causing the problem and i get to Forbidden You don't have permission to access /xx/xx/xxxx.jsp The search is fine in local setup with the abscence of Web Server. As i saw some posts suggesting the issue could be caused by Web server config. What

Special character not recognized

Deadly 提交于 2020-01-06 14:19:23
问题 It seems as though he special characters are all recognized as the same thing on my system. Here is some sample code: // Function that processes a string to put to lowercase and remove special characters function NormalizeString(s){ var r=s.toLowerCase(); if(r.indexOf('é')!=0){ r=Left(r,r.indexOf('é')) + 'e' + Right(r,r.length-r.indexOf('é')-1) } return r; } This works and changes the é to an e. Now if I add to this program : // Function that processes a string to put to lowercase and remove

Microsoft Access TransferText function: problem with codepage

不羁岁月 提交于 2020-01-05 08:34:37
问题 I inherited a huge, bulky MS Access database and am assigned to solve a problem in it. The problem is as follow... System A exports its data to a pipeline-delimited .txt file. The files has special characters working correctly, for example the value "Müller" shows when opening this file in notepad or Excel. Next, the Access DB imports the .txt file and stores the result in an internal employees table. The last name field is of data type "memo". The method to import data from the .txt file to

CouchDB and Special Characters

ぃ、小莉子 提交于 2020-01-05 05:57:06
问题 Question...I am trying to add data to CouchDB via the _bulk_docs API. For the most part I have this working, but any JSON value that contains a special character (e.g. certain Spanish or French characters exist in my data) results in an "invalid JSON" error given by CouchDB, and the data is rejected. I'm not sure what I need to set in order to get this to work. Any suggestions? CouchDB seems to get the data properly (at least it looks correct in its log file), but it is not processed unless I

CakePHP 3.1-rc1 utf-8 special chars output

南楼画角 提交于 2020-01-05 00:53:57
问题 During the migration from 2.6 to 3.1 may encounter problems with the display of special characters in the Croatian language. The content is taken from the database. Content is stored in a database via CakePHP 2.x applications, and can be displayed properly. but when I connect a new application I have a problem with the proper display of these characters čćšđž. database / tables : MyISAM utf8_general_ci cakephp 2.x app public $default = array( 'datasource' => 'Database/Mysql', 'persistent' =>