special-characters

How to use jq when the variable has a period

我怕爱的太早我们不能终老 提交于 2019-11-26 14:46:15
问题 I'm trying to get the following to work & it's not, help me please: curl -s 'https://cryptofresh.com/api/asset/markets?asset=MKR' | jq .OPEN.BTC The variable in question includes a period, I tried just about everything to escape the period && also tried surrounding it in quotes; no go ; this is the variable I'm looking to pull from (I ran jq without any filters, and truncated the output here to show what I need. Thanks in advance future problem solver! curl -s 'https://cryptofresh.com/api

WebClient.DownloadString() returns string with peculiar characters

社会主义新天地 提交于 2019-11-26 14:39:56
I have an issue with some content that we are downloading from the web for a screen scraping tool that I am building. in the code below, the string returned from the web client download string method returns some odd characters for the source download for a few (not all) web sites. I have recently added http headers as below. Previously the same code was called without the headers to the same effect. I have not tried variations on the 'Accept-Charset' header, I don't know much about text encoding other than the basics. The characters, or character sequences that I refer to are: "  " and " Â

Characters allowed in GET parameter

百般思念 提交于 2019-11-26 14:30:34
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! There are reserved characters , that have a reserved meanings, those are delimiters — :/?#[]@ — and subdelimiters — !$&'()*+,;= There is also a set of characters called unreserved characters — alphanumerics and -._~ — which are not to be

Browser displays � instead of ´

假如想象 提交于 2019-11-26 14:23:50
问题 I have a PHP file which has the following text: <div class="small_italic">This is what you´ll use</div> On one server, it appears as: This is what you´ll use And on another, as: This is what you�ll use Why would there be a difference and what can I do to make it appear properly (as an apostrophe)? Note to all (for future reference) I implemented Gordon's / Gumbo's suggestion, except I implemented it on a server level rather than the application level. Note that (a) I had to restart the Apache

List of special characters for SQL LIKE clause

一曲冷凌霜 提交于 2019-11-26 14:06:44
What is the complete list of all special characters for a SQL (I'm interested in SQL Server but other's would be good too) LIKE clause? E.g. SELECT Name FROM Person WHERE Name LIKE '%Jon%' SQL Server : % _ [specifier] E.g. [a-z] [^specifier] ESCAPE clause E.g. %30!%%' ESCAPE '!' will evaluate 30% as true ' characters need to be escaped with ' E.g. they're becomes they''re MySQL: % - Any string of zero or more characters. _ - Any single character ESCAPE clause E.g. %30!%%' ESCAPE '!' will evaluate 30% as true Oracle: % - Any string of zero or more characters. _ - Any single character ESCAPE

for name in `ls` and filenames with spaces

会有一股神秘感。 提交于 2019-11-26 14:06:42
问题 next code doesnt work because of spaces in file names, How to fix? IFS = '\n' for name in `ls ` do number=`echo "$name" | grep -o "[0-9]\{1,2\}"` if [[ ! -z "$number" ]]; then mv "$name" "./$number" fi done 回答1: Just don't use command substitution: use for name in * . 回答2: Replace for name in `ls` with: ls | while read name Notice : bash variable scoping is awful. If you change a variable inside the loop, it won't take effect outside the loop (in my version it won't, in your version it will).

removing emojis from a string in Python

青春壹個敷衍的年華 提交于 2019-11-26 13:28:33
I found this code in Python for removing emojis but it is not working. Can you help with other codes or fix to this? I have observed all my emjois start with \xf but when I try to search for str.startswith("\xf") I get invalid character error. emoji_pattern = r'/[x{1F601}-x{1F64F}]/u' re.sub(emoji_pattern, '', word) Here's the error: Traceback (most recent call last): File "test.py", line 52, in <module> re.sub(emoji_pattern,'',word) File "/usr/lib/python2.7/re.py", line 151, in sub return _compile(pattern, flags).sub(repl, string, count) File "/usr/lib/python2.7/re.py", line 244, in _compile

How to display special characters in PHP

二次信任 提交于 2019-11-26 12:47:18
问题 I\'ve seen this asked several times, but not with a good resolution. I have the following string: $string = \"<p>Résumé</p>\"; I want to print or echo the string, but the output will return <p>R�sum�</p> . So I try htmlspecialchars() or htmlentities() which outputs <p>Résumé<p> and the browser renders <p>Résumé<p> . I want it, obviously, to render this: Résumé And I\'m using UTF-8: header(\"Content-type: text/html; charset=UTF-8\"); What am I missing here? Why does echo and print output a �

Enter “&” symbol into a text Label in Windows Forms?

◇◆丶佛笑我妖孽 提交于 2019-11-26 12:23:51
How would one enter special characters into a Label in C# (Windows Forms)? If you try to write a "&" into a label you'll get a sort of underscore instead.. So what's the C# equivalent of "&"? ("\&" obviously doesn't work). Two ways: Escape it with another ampersand ( && ). Set UseMnemonic for that label to false . This causes all ampersands within the text to be taken literally so you don't need to double any of them. You'll lose the underlining and access key features though. You can set the value either in the designer, or in code: myLabel.UseMnemonic = false; myLabel.Text = "Text&Text"; Add

how to replace special characters with the ones they&#39;re based on in PHP?

你说的曾经没有我的故事 提交于 2019-11-26 12:22:28
How do I replace: "ã" with "a" "é" with "e" in PHP? Is this possible? I've read somewhere I could do some math with the ascii value of the base character and the ascii value of the accent, but I can't find any references now. This answer is incorrect. I didn't understand Unicode Normalization when I wrote it. Look at francadaval's comment and link Check out the Normalizer class to do this. The documentation is good, so I'll just link it instead of repeating things here: http://www.php.net/manual/en/class.normalizer.php Specifically, the normalize member of that class: http://www.php.net/manual