special-characters

PHP: regular expression to remove `â` or `â€`?

筅森魡賤 提交于 2019-12-23 15:48:25
问题 I use this regular expression to remove all the punctuation marks from a string input, $pg_url = preg_replace("/\W+/", " ", $pg_url); but there are some kind of symbols or special characters I can't remove them, such as – when I pass this into my db injection, it will either turns into â or †How can I get rid of these strange stuff? Thanks. 回答1: Those characters are encoded in Unicode, specifically UTF-8. You may want to consider using the iconv family of functions to convert them into some

xml parsing with “&”, “®”, but still getting errors

老子叫甜甜 提交于 2019-12-23 15:35:43
问题 Everywhere I look, posts are telling me to escape xml special characters with their html entity, but I'm still getting XML parsing errors. The error message I'm receiving is "unidentified entity", and it occurs at the &amp ; and &reg ; marks (without the spaces). How can I fix this and why would this still be throwing errors? <?xml version="1.0" encoding="UTF-8"?> <maps> <location id="tx"> <item label="Lobby & Entrance" xpos="125" ypos="112" /> <item label="Restaurant & Bar" xpos="186" ypos=

javascript - encodeUriComponent with exclamation mark?

谁说我不能喝 提交于 2019-12-23 09:10:11
问题 Native encodeURIComponent doesn't support encoding exclamation mark - ! which I need to have in url's query param encoded properly.. node.js querystring.stringify() doesn't it as well.. is the only way to use custom function like - https://github.com/kvz/phpjs/blob/master/functions/url/urlencode.js#L30 ? 回答1: You could re-define the native function to add that functionality. Here's an example of extending encodeURIComponent to handle exclamation marks. // adds '!' to encodeURIComponent

How do I convert special characters using java?

…衆ロ難τιáo~ 提交于 2019-12-23 07:46:26
问题 I have strings like: Avery® Laser & Inkjet Self-Adhesive I need to convert them to Avery Laser & Inkjet Self-Adhesive. I.e. remove special characters and convert html special chars to regular ones. 回答1: Avery® Laser & Inkjet Self-Adhesive First use StringEscapeUtils#unescapeHtml4() (or #unescapeXml(), depending on the original format) to unescape the & into a & . Then use String#replaceAll() with [^\x20-\x7e] to get rid of characters which aren't inside the printable ASCII range. Summarized

Parsing html numbers like “&#189” in dom parser - android

隐身守侯 提交于 2019-12-23 05:12:23
问题 I am developing an android project. I am using dom parser to parse the xml file. Issue is my xml file contains html numbers like &#189 (semicolon will come in the end of every char code) for example <quote>We “love” our nation</quote> which is nothing but <quot>We "love" our nation</quote> I am not able to parse this html number in dom parse, when I try to get the node value, I am getting null. Can anyone tel me how to parse this html character codes? or How to convert this html char code as

Symbolicate Crash Log when App Name Contains Apostrophe and Space (Deployed App)

半腔热情 提交于 2019-12-23 02:32:30
问题 I have an app on the App Store that is crashing. I have tried several of the solutions on SO to symbolicate my app, using at different times the Organizer, the Terminal, and Instruments. Nothing has worked so far - the lines in the reports from the methods in my app are never symbolicated, even when the lines for Apple methods are. After looking around for a while, it seems as though this might have something to do with the app name, which is along the lines of "Angie's List" - with both an

How to remove carriage returns in the middle of a line

天大地大妈咪最大 提交于 2019-12-23 02:22:21
问题 I have file that is read by application in unix and windows. However I am encountering problems when reading in windows with ^M in the middle of the data. I am only wanting to remove the ^M in the middle of the lines such as field 4 and field 5. I have tried using perl -pe 's/\cM\cJ?//g' but it removes everything into one line which i don't want. I want the data to stay in the same line but remove the extra ones # Comment^M # field1_header|field2_header|field3_header|field4_header|field5

jQuery Autocomplete and Special Characters in WordPress

泪湿孤枕 提交于 2019-12-22 18:47:17
问题 Hopefully im not missing an already existing answer to this question. Im working with a wordpress theme that uses jquery ui autocomplete to provide category selections in a front end form. Code is below. Problem is that if a category name has an &, it cant display the character and instead shows & in the autocomplete box. Can i make it show the character properly? ` jQuery(function(){ /* Auto Complete */ var availableTags = [ <?php $terms_array = array(); $terms = get_terms( 'majors', 'hide

PostgreSQL encoding issue while executing query from command line

我与影子孤独终老i 提交于 2019-12-22 15:04:59
问题 I am trying to execute an SQL query which is stored in the file. I am using following command to execute: psql -d DB_NAME -a -f QUERY_NAME.sql I have some non English text in the SQL file like - સુરત When the query is executed the text in the database looks like - à ª¸à «Âà ª°à ª¤ How do I execute the query from command line so that it runs correctly? 回答1: Make sure the client_encoding matches the encoding of your file. Check your system locale. Then use a matching command line

invalid multibyte character crashes when script is loaded from source (umlauts / special characters)

微笑、不失礼 提交于 2019-12-22 12:39:20
问题 EDIT: Thx to suggestions from the mailing list I realized that the problem I got has nothing to do with Sweave or Latex. It´s some Mac OS X related issue. Whenever I run my script by selecting all and sending it to R it works. When I use source("myplainRcode.R") i get the error message stated below finally I got sweave working together with ggplot2 on my Mac OS X. I invoke Sweave inside R with Sweave("myfile.Rnw") which creates the desired latex output. Now that the basic tests work, I try to