special-characters

PHP htmlentities() not working as expected

爷,独闯天下 提交于 2019-11-28 14:37:40
I'm having a problem with htmlentities() $txt = "árbol"; echo $txt; // outputs: árbol echo htmlentities($txt); // outputs: árbol (árbol) The second echo should output árbol (á) I'm using utf-8: <meta charset="utf-8"> What's going on? Thank you! You have to set the third parameter of htmlentities() which tells the charset to use. Because of you don't set it, the default is used and the default is ISO-8859-1, not UTF-8. Like htmlspecialchars(), it takes an optional third argument charset which defines character set used in conversion. Presently, the ISO-8859-1 character set is used as the

url encode behaving differently in Firefox and Internet Explorer

穿精又带淫゛_ 提交于 2019-11-28 14:32:06
I want to send a user's entry to google's geocode API. In doing so, I detected a problem. When I send the user input (e.g. "köln+Germany") through my script to the api in Firefox it works great. In Internet Explorer however it's not working. Here's the exempt of my code that's enough to show the problem: header('Content-type: text/html; charset=UTF-8'); header('Cache-Control: no-cache, must-revalidate'); $loc = urlencode($_GET['loc']); echo $address = "http://maps.googleapis.com/maps/api/geocode/json?address=$loc&sensor=false"; The output ($address) in Firefox is: http://maps.googleapis.com

for loop through files with spaces and some special characters

99封情书 提交于 2019-11-28 13:02:47
问题 I need to run the following command with a for loop cat Locate\ Message.eml | ./locatePipe.php I am trying the following however it seems to break on the first space in the file name for i in $(find -name "*.eml"); do cat $i | ./locatePipe.php; done Some of the file names contain "@", "()", "-", ".", "[]", " ' " if that matters 回答1: Use the -exec option find -name '*.eml' -exec cat {} + | ./locatePipe.php 回答2: I accomplished this using the following command find -name '*.eml' | while read

Where can I find a list of all special HTML characters? [closed]

时间秒杀一切 提交于 2019-11-28 12:51:33
I'm in the process of adding various physics equations to a website. There are several special characters I've needed to add, and I haven't been able to find some of them (for instance, I need to add a curled "E" to denote energy density, and I need to add an H with the '^' symbol on top to denote the Hamiltonian operator). Thus, I was wondering if anyone has compiled a table of all the various HTML special characters (such as ħ for h-bar, which equals h/2PI). If so, a link would be much appreciated! Thanks! How about this, from the w3 org: http://dev.w3.org/html5/html-author/charref With just

Regex - With Space and Special Characters

自闭症网瘾萝莉.ら 提交于 2019-11-28 12:07:37
问题 I'm using the following Regex ^[a-zA-Z0-9]\s{2,20}$ for input Letters A - Z Letters a - z Numbers 0 - 9 The input length must be a least 2 characters and maximum 20 characters. I also want to enable space in the input, but only space, not new line, etc. Last thing I have problem with is that I want to enable characters such as !@#$%^&*)( 回答1: add characters to your regex code like this~ ^[a-zA-Z0-9 !@#$%^&*)(]{2,20}$ the \s is not only express space.. 回答2: Try ^[a-zA-Z0-9 ]{2,20}$ . And are

Deleting filenames that have space and special characters

痞子三分冷 提交于 2019-11-28 12:05:41
问题 I have a large filelist of 7000+ files to delete from a Unix directory. I could have accomplished this using a while loop while read file do rm $file done < filelist or just cat filelist | xargs rm The challenge comes from deleting those files which have "Windows-like back slash \, colon : and spaces " in their filenames. Eg. C:\Sxxx Accr Vac 1111.txt N:\Lxxx\Dxxx_FOLDER\Mxxx\Mxxx_DOWNLOAD_TEXTFILE_PATH\000000_Mxxx_Bxxx-Pxxx-H.txt N:\Lxxx\Dxxx_FOLDER\Mxxx\Mxxx_DOWNLOAD_TEXTFILE_PATH\130607

How do I find the string between two special characters?

一个人想着一个人 提交于 2019-11-28 12:04:16
For example, I need everything in between the two square brackets. File1 [Home sapiens] [Mus musculus 1] [virus 1 [isolated from china]] So considering the above example, I need everything in between the first and last square brackets. Regular expressions are the most flexible option. For another approach, you can try string's partition and rpartition methods: >>> s = "[virus 1 [isolated from china]]" >>> s.partition('[')[-1].rpartition(']')[0] 'virus 1 [isolated from china]' You can use a greedy regex: re.search(r'\[(.*)\]', your_string).group(1) Given your sample input, it looks like every

Separate string by tab characters

安稳与你 提交于 2019-11-28 11:52:46
I have a text file that is tab-delimited. How can I separate this string into substrings for an array by detecting the tabs? CD.. string s = "123\t456\t789"; string[] split = s.Split('\t'); If you use String.split() you can split the String around any regular expression, including tabs. The regex that matches tabs is \t, so you could use the following example; String foo = "Hello\tWorld"; String[] bar = foo.split("\t"); Which would return a String array containing the words Hello and World Just use the String.Split method and split on tabs (so probably first one split on newlines to get the

How can I use a special char in a C# enum?

让人想犯罪 __ 提交于 2019-11-28 11:07:39
For example: public enum Unit{ KW, kV, V, Hz, %V } In this case % is a special character. So, how can I put this char in a enum? Enum members shouldn't be used for user interface display purposes. They should be mapped to a string in order to get displayed. You can create a string array (or a dictionary) that maps each enum member to a string for user interaction. That said, to answer your question directly, you can use \uxxxxV were xxxx is the hexadecimal number representing the Unicode code point for % . This is far from recommended. As Henk points out, this won't work for % as it's not in

Unicode special characters appear differently in Firefox vs. Chrome/IE

懵懂的女人 提交于 2019-11-28 10:06:39
问题 I'm trying to find a way to make dingbats appear exactly the same in Firefox, Chrome, Safari and IE. I noticed that the Dingbats appear the same in IE/Chrome/Safari, HOWEVER - in Firefox - they look "thinner". For example - try to visit the following page: http://en.wikipedia.org/wiki/Dingbat You'll notice that when viewing that page in Firefox - the characters look different in comparison to Chrome/IE. Does anybody know why and how can I cause Firefox to display the characters EXACTLY like