special-characters

Trouble replacing Chr(160) with VBA in excel

亡梦爱人 提交于 2019-12-10 11:24:35
问题 I have been receiving excel files for awhile that are usually plagued with the special character alt+0160 after the accounts. I usually just manually replace it in excel but recently I've grown lazy and want to replace it using my VBA script. This script is used to insert the needed columns into our database: Sub insert() Dim sSql As String Dim db As New ADODB.Connection 'Go to Tools, References and turn on ActiveX Data Objects 2.8 Library db.Open "DSN=XXXX;uid=XXXX;pwd=XXXX" 'INSERT ORACLE

regex - brackets and parenthesis in character-class

时间秒杀一切 提交于 2019-12-10 11:22:29
问题 I would like to match these characters: [ ] ( ) in a character class in a regex, how can I do that? echo 'some text (some text in parenthesis) [some other in brackets]' | grep '[\[\]\(\)]' This one doesn't match any character. 回答1: You can use it like this: echo 'some text (some text in paranthesis) [some other in brackets]' | grep -o '[][()]' ( ) [ ] You don't need to escape ( and ) inside a character class. Moreover if you place ] and [ right after opening [ then you don't need to escape

Method to substitute foreign for English characters in Java?

拈花ヽ惹草 提交于 2019-12-10 10:44:33
问题 In PHP I would use this: $text = "Je prends une thé chaud, s'il vous plaît"; $search = array('é','î','è'); // etc. $replace = array('e','i','e'); // etc. $text = str_replace($search, $replace, $text); But the Java String method "replace" doesn't seem to accept arrays as input. Is there a way to do this (without having to resort to a for loop to go through the array)? Please say if there's a more elegant way than the method I'm attempting. 回答1: A really nice way to do it is using the

Trying to stop bullets in textareas from entering my database as special characters

一曲冷凌霜 提交于 2019-12-10 10:36:57
问题 I am using this currently, but it doesn't seem to be working for bullets: function sanitizeMySQL($var){ $var = mysql_real_escape_string($var); $var = sanitizeString($var); return $var; } function sanitizeString($var) { $var = str_replace('•','•', $var); $var = htmlentities($var); $var = strip_tags($var); return $var; } This is what bullets show up like in my db after someone has submitted them through a textarea: • EDIT: This is now what I am getting: • . I do have bullets stored in my

Python removing extra special unicode characters

浪尽此生 提交于 2019-12-10 10:35:42
问题 I'm working with some text in python, it's already in unicode format internally but I would like to get rid of some special characters and replace them with more standard versions. I currently have a line that looks like this, but it's getting ever more complex and I see it will eventually bring more trouble. tmp = infile.lower().replace(u"\u2018", "'").replace(u"\u2019", "'").replace(u"\u2013", "").replace(u"\u2026", "") for example the u\2018 and \u2019 are left and right single quotes.

php utf-8 decode from xml returns question marks

你。 提交于 2019-12-10 09:57:35
问题 I have some problems using xml. I know this is a comon question, but the answers i found didn't fix my problem. The problem is that when I add é or ä or another special char to my xml file, with php domdocument, it saves the é as xE9 and the ä as xE4. I don't know if this is ok but when I want to show the output it shows question marks at this places. I have tried alot. Like removing and adding the encoding in de xml header in the php domdocument. I also tried using file_get_contents and use

Remove weird invalid character in ruby

爷,独闯天下 提交于 2019-12-10 09:43:40
问题 I have some XML content (UTF-8), that contains invalid characters (nokogiri tells me Line 2190, SyntaxError: PCDATA invalid Char value 15 when I try to parse the content with Nokogiri::XML(content) ). The character is displayed in Sublime Text editor as a "SI": When I try to copy the character, nothing gets copied, so I can't even look it up. When I open it for example in my Atom Editor, the "SI" is not displayed. However, when I step through the characters with the right key, I have to type

Special (or foreign countries) characters

有些话、适合烂在心里 提交于 2019-12-10 09:42:14
问题 I am new to C# and was experimenting with the ASP.Net GridView (framework 3.5), and I found out a big problem when the gridView text contains the following: ñ/Ñ/á/Á/é/É/í/Í/ó/Ó/ú/Ú or a â, ê, î, ô, û, ë, ï, ü or even a ç The results end up displaying something like this: &+#+237 I made a mixture of pain by doing a table,dataset etc... to get the data from the database clean as the letter itself. I also tried making a method that cleaned the variables but it was a terrible IF. I was wondering

How do I make control characters programatically in Javascript?

孤者浪人 提交于 2019-12-10 09:30:31
问题 In Javascript I can type '\u00A3' to get a character using its char code. I can do this programatically to with String.fromCharCode(parseInt('00A3', 16)) . But I can't find a way to do the same for a control character. I can type them in my source code but I want a way to generate them in code. 回答1: Sounds to me like you could just use this list: http://en.wikipedia.org/wiki/C0_and_C1_control_codes and use the character points defined there to insert them with \u or String.fromCharCode as in

Quote POSIX shell special characters in Python output

拜拜、爱过 提交于 2019-12-10 04:35:08
问题 There are times that I automagically create small shell scripts from Python, and I want to make sure that the filename arguments do not contain non-escaped special characters. I've rolled my own solution, that I will provide as an answer, but I am almost certain I've seen such a function lost somewhere in the standard library. By “lost” I mean I didn't find it in an obvious module like shlex , cmd or subprocess . Do you know of such a function in the stdlib? If yes, where is it? Even a