special-characters

What is the difference between iconv() and mb_convert_encoding() in PHP?

丶灬走出姿态 提交于 2019-11-27 10:42:17
问题 What's the difference between iconv() and mb_convert_encoding() in PHP? Does one perform better, faster, etc. ( eg. with specific encodings )? In what situations would one be preferred over the other? Here's what I think I know already: iconv() included with most installs of PHP. when characters that can't be mapped to the new character set are found, you can specify if they are converted to a 'similar' character, or ignored. mb_convert_encoding() usually requires installing the php-mbstring

grep for special characters in Unix

我怕爱的太早我们不能终老 提交于 2019-11-27 10:35:58
I have a log file (application.log) which might contain the following string of normal & special characters on multiple lines: *^%Q&$*&^@$&*!^@$*&^&^*&^& I want to search for the line number(s) which contains this special character string. grep '*^%Q&$*&^@$&*!^@$*&^&^*&^&' application.log The above command doesn't return any results. What would be the correct syntax to get the line numbers? Prince John Wesley Tell grep to treat your input as fixed string using -F option. grep -F '*^%Q&$*&^@$&*!^@$*&^&^*&^&' application.log Option -n is required to get the line number, grep -Fn '*^%Q&$*&^@$&*!^

What is a vertical tab?

早过忘川 提交于 2019-11-27 10:30:32
What was the original historical use of the vertical tab character ( \v in the C language, ASCII 11)? Did it ever have a key on a keyboard? How did someone generate it? Is there any language or system still in use today where the vertical tab character does something interesting and useful? BillThor Vertical tab was used to speed up printer vertical movement. Some printers used special tab belts with various tab spots. This helped align content on forms. VT to header space, fill in header, VT to body area, fill in lines, VT to form footer. Generally it was coded in the program as a character

Looking for special characters in Google [closed]

二次信任 提交于 2019-11-27 10:13:53
问题 Do you know how to look for special characters with google...? I'm looking at bash code and there's the ## operator. I would like to know what It does but I wasn't able to figure out a way to protect the character (I'm not sure it's even possible). This is particularly annoying when you're looking for some code patterns, some characters are always ignored. 回答1: Google strips most punctuation from queries, as described here, so it won't help you with the bash syntax. It's very easy to search

How to ignore acute accent in a javascript regex match?

二次信任 提交于 2019-11-27 09:40:58
I need to match a word like 'César' for a regex like this /^cesar/i . Is there an option like /i to configure the regex so it ignores the acute accents?. Or the only solution is to use a regex like this /^césar/i . The standard ecmascript regex isn't ready for unicode (see http://blog.stevenlevithan.com/archives/javascript-regex-and-unicode ). So you have to use an external regex library. I used this one (with the unicode plugin) in the past : http://xregexp.com/ In your case, you may have to escape the char é as \u00E9 and defining a range englobing e, é, ê, etc. EDIT : I just saw the comment

How to escape dollar sign ($) in a string using perl regex

雨燕双飞 提交于 2019-11-27 09:40:27
I'm trying to escape several special characters in a given string using perl regex. It works fine for all characters except for the dollar sign. I tried the following: my %special_characters; $special_characters{"_"} = "\\_"; $special_characters{"$"} = "\\$"; $special_characters{"{"} = "\\{"; $special_characters{"}"} = "\\}"; $special_characters{"#"} = "\\#"; $special_characters{"%"} = "\\%"; $special_characters{"&"} = "\\&"; my $string = '$foobar'; foreach my $char (keys %special_characters) { $string =~ s/$char/$special_characters{$char}/g; } print $string; Try this: my %special_characters;

Insert the carriage return character in vim

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 09:31:11
问题 I'm editing a network protocol frame stored a file in Unix ( \n newlines). I need to insert the carriage return character ( U+000D aka \r ). When I try to paste it from the clipboard ( "+p ) or type it using Ctrl + Shift + u - 000d , the linefeed is inserted ( U+000A ). What is the right way to do it? 回答1: Type: ctrl - v ctrl - m On Windows Use: ctrl - q ctrl - m Ctrl - V tells vi that the next character typed should be inserted literally and ctrl - m is the keystroke for a carriage return.

HTML for the Pause symbol in audio and video control

假如想象 提交于 2019-11-27 09:24:06
问题 I'm trying to find the Unicode symbol to make a button display the Unicode pause symbol. I was able to find that the Unicode play symbol is &#9658 but I'm looking for the equivalent of the Unicode pause symbol. 回答1: There are various symbols which could be considered adequate replacements, including: | | - two standard (bolded) vertical bars. ▋▋ - ▋ and another ▋ ▌▌ - ▌ and another ▌ ▍▍ - ▍ and another ▍ ▎▎ - ▎ and another ▎ ❚❚ - ❚ and another ❚ I may have missed out one or two, but I think

PHP htmlentities() not working as expected

这一生的挚爱 提交于 2019-11-27 08:59:44
问题 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! 回答1: 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

url encode behaving differently in Firefox and Internet Explorer

女生的网名这么多〃 提交于 2019-11-27 08:33:35
问题 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