special-characters

Use of special characters in function names

余生颓废 提交于 2019-12-04 08:55:56
问题 In Ruby, a standard convention is to use a question mark at the end of a method name to indicate the method returns a boolean result: [].empty? #=> true Another standard convention is to end a method name with an exclamation point if the method is destructive (that is, it modifies the original data): mylist.sort! # sort mylist in-place Recently I have seen these same conventions used in Scheme. Which makes me wonder, what other languages use/support this convention? Are there any other

Python subprocess check_output decoding specials characters

怎甘沉沦 提交于 2019-12-04 07:55:51
I'm having some issues with python encoding. When I try to execute this: subprocess.check_output("ipconfig", shell=True) it gives me an output with special characters in it, like: "Statut du m\x82dia" "M\x82dia d\x82connect\x82" (i'm french) When I try decoding it with a .decode() at the end, it gives me this error: UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 78: invalid start byte I tried using .decode("utf-8") , I played around with encoding and decoding for hours, and I can't find the answer. Everything I looked on the internet didn't work. Maybe I'm just dumb, but

R how to remove VERY special characters in strings?

和自甴很熟 提交于 2019-12-04 07:32:13
I'm trying to remove some VERY special characters in my strings. i've read other post like: Remove all special characters from a string in R? How to remove special characters from a string? but these are not what im looking for. lets say my string is as following: s = "who are í ½í¸€ bringing?" i've tried following: test = tm_map(s, function(x) iconv(enc2utf8(x), sub = "byte")) test = iconv(s, 'UTF-8', 'ASCII') none of above worked. edit: I am looking for a GENERAL solution! I cannot (and prefer not) manually identify all the special characters. also these VERY special characters MAY (not 100%

SQLite FTS4 search with special characters

孤人 提交于 2019-12-04 07:12:26
I have an Android app which searches for data in an SQLite database with FTS4 virtual tables. It works fine, but when the data inside the tables contain special characters (like 'á', 'é', 'í', 'ó', 'ú' or 'ñ') the SQLite MATCH function gives no results. I'm lost at this point. Thanks. Attention: default tokenizer is really poor. To get good results you should implement a custom tokenizer. The path isn't so simple: find the tokenizer (with stemmer?) that should fit your need, or develop it glue it with sqlite.c sources glue a JNI interface to wrap the native library so it will be accessible

How do I match accented characters in preg_match()?

自闭症网瘾萝莉.ら 提交于 2019-12-04 05:56:29
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. Use the /u modifier. That will enable Unicode for the regexes. http://php.net/manual/en/reference.pcre.pattern.modifiers.php 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-accented-characters-in-preg-match

Escape special character in a windows batch

血红的双手。 提交于 2019-12-04 05:29:00
问题 I have a batch file that receive a path as first argument. The path is always composed with specials characters like ^ , é or è . The call is similar to this D:\Script>MyBatch My\path\test_00170_LASTNAME^Firstname\image There is always this error: unknown specified path When I echo the first argument in my bash I can see (notice the missing ^ ) My\path\test_00170_LASTNAMEFirstname\image So I tried to escape this character by adding another ^ just before My\path\test_00170_LASTNAME^^Firstname

Extract until end of line after a special character: Python

我们两清 提交于 2019-12-04 05:21:23
问题 I need the string after '#' in each line and all lines have the #. I already have a regex matching the line and when I add the comment part to this it doesn't work. I get all the lines after the first comment as one group. Line format: Line1 blah blah... }}#Comment1 or it could be Line1 blah blah...}}# Comment1 Either there is a space between the '#' and comment or no space. Right now it matches until the first curly braces. My code: Linepattern = re.compile(r'\{(\s*(\w+)\s*|(\w+)|(\w+)\s*)\{

T-SQL special characters to escape for LIKE operator wildcard search

青春壹個敷衍的年華 提交于 2019-12-04 05:04:59
SQL Server has the LIKE operator to handle wildcard searches. My customer wants to use the "*" (asterisk) character in the user interface of an application as the wildcard character. I'm just wondering if there are any standard characters that I need to worry about (that are used as special characters in SQL Server) besides the "%" (percent) character itself before performing a LIKE wilcard search in case their keyword contains a "%" and needs to find a "%" in the actual string. If so, what are they? So please assume that [table1].[column1] will never have a "*" (asterisk) in the text string!

convert/normalize special characters when using jspdf

橙三吉。 提交于 2019-12-04 04:27:35
问题 Trying to use the jspdf lib @1.4.1 to convert text to pdf, the output sometimes gets so ugly and unreadable, because the text contains some special characters, like: the left single quotation mark U+2018 , or the right one U+2019 , or symbols like → , or the ı in Kadıköy ... how can i sanitize/normalize such texts? or is there any option is jspdf that i can use to fix this problem? update: to reproduce the problem , just use this string: '→Kadıköy' in this example https://parall.ax/products

How to Convert Special Chars to Standard Chars?

自闭症网瘾萝莉.ら 提交于 2019-12-04 04:11:22
问题 I'm looking for way to convert chars like āžšķūņrūķīš to azskunrukis . In other words, to replace ā with a , ž with z and so. Is there anything built-in, or I should create my own "library" of from-to symbols? 回答1: Take a look at iconv's transliteration capabilities: <?php $text = "This is the Euro symbol '€'."; echo 'Original : ', $text, PHP_EOL; echo 'TRANSLIT : ', iconv("UTF-8", "ISO-8859-1//TRANSLIT", $text), PHP_EOL; echo 'IGNORE : ', iconv("UTF-8", "ISO-8859-1//IGNORE", $text), PHP_EOL;