special-characters

JavaScript Remove special characters string not working

纵饮孤独 提交于 2019-11-29 17:21:44
I'm trying to remove special characters that could appear within my Google Analytics tags, as the special characters seem to be causing script errors in some versions of IE. I have this function: function removeSplChars(inStr) { inStr = inStr.replace(/[^a-zA-Z0-9 ]/g, ""); return inStr; } and there is the GA code that currently works: <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', '<c:out value="${profileId}"/>']); <c:choose> <c:when test="${(lastCmdName eq 'CategoryDisplay') or (lastCmdName eq 'ProductDisplay')}" > _gaq.push(['_setCustomVar', 2, // This

Regex - With Space and Special Characters

耗尽温柔 提交于 2019-11-29 16:44:19
I'm using the following Regex ^[a-zA-Z0-9]\s{2,20}$ for input Letters A - Z Letters a - z Numbers 0 - 9 The input length must be a least 2 characters and maximum 20 characters. I also want to enable space in the input, but only space, not new line, etc. Last thing I have problem with is that I want to enable characters such as !@#$%^&*)( add characters to your regex code like this~ ^[a-zA-Z0-9 !@#$%^&*)(]{2,20}$ the \s is not only express space.. Try ^[a-zA-Z0-9 ]{2,20}$ . And are you sure your original expression worked? The quantifier {2,20} is only applied to the \s , and not to your set

How to use special characters in choice command - Batch File

痴心易碎 提交于 2019-11-29 16:03:20
I would like to add special characters like < | into my choice command, how can I do that? Here's my old code: CHOICE /C ABCDEFGHIJKLMNOPQRSTUVWXYZ0134567928 /N /M "Press 8 ...." and I would like it to be something like : CHOICE /C `~,.<>?ABCDEFGHIJKLMNOPQRSTUVWXYZ0134567928 /N /M "Press 8 ...." Any help will be appreciated, thanks. EDIT: Since some of you may ask why do I need so many choice, I'm here to answer. It is because pressing an invalid choice would give you an annoying beep that I would not like. Therefore I asked this question. The CHOICE command only allows alpha-numeric

Batch: Auto escape special characters

血红的双手。 提交于 2019-11-29 15:41:47
As far as I know, I need to escape every escape characters when echoing them. The ^ method works fine for a few echo es. (which should be something like:) @echo ^| @echo ^> ^>^> However, when there are a lot of characters to escape, the ^ method won't work anymore. So, my question is: Are there any ways escape all special characters without "spamming" the caret? Mofi Well, there is no need to escape redirection operators and other special characters listed in last paragraph in help output by running cmd /? in a command prompt window on last help page when the string to output is enclosed in

Trouble using/displaying special characters from Oracle db in .Net app

淺唱寂寞╮ 提交于 2019-11-29 15:30:03
I have a C#.Net application that accesses data from a commercial application backed by an Oracle 10 db. A couple of fields in the commercial app's database (declared as varchar2(n)) contain special characters. The "smart quote" apostrophe, for example. The commercial client app displays these characters correctly, but my application is displaying them as an inverted question mark. The Oracle character set is "WE8ISO8859P1". My application reads the commercial database using System.Data.OracleClient.OracleDataAdapter, converted into a table via DataSet.Tables. The tablerows are converted into

How to escape special characters in a file parsed by PHP parse_ini_file function?

烂漫一生 提交于 2019-11-29 14:52:02
I'd like to keep a certain string in a configuration file, that is to be parsed by PHP parse_ini_file() function. However, this string contains some special characters (with codes like 0x2C or 0x3D ) that need to be encoded in some way. Is there any way to write a special character with a hex code in such a file? The proper way to escape INI values is to enclose them in "double quotes" . If your string doesn't contain double quotes, you can use it in as a value enclosed in double quotes. Escaping single quotes with a backslash seems to work as long as there are not two consecutive double

bash scripting - read single keystroke including special keys enter and space

好久不见. 提交于 2019-11-29 14:12:37
问题 Not sure if I should put this on stackoverflow or unix.stackexchange but I found some similar questions here, so here it goes. I'm trying to create a script to be called by .bashrc that allows me to select one of two options based on a single keystroke. That wouldn't be hard normally but I want the two keys corresponding to the two options to be space and enter. Here's what I got so far: #!/bin/bash SELECT="" while [[ "$SELECT" != $'\x0a' && "$SELECT" != $'\x20' ]]; do echo "Select session

XMLHTTP and Special Characters (eg, accents)

為{幸葍}努か 提交于 2019-11-29 14:08:49
I am using Microsoft.XMLHTTP via VBA to pull in the body of a web page. In doing so, characters such as é get replaced with "?" or something equally not useful. Here's the basic code: Set objHTTP = CreateObject("Microsoft.XMLHTTP") objHTTP.Open "GET", ThisWebPage, False objHTTP.setRequestHeader "Content-Type", _ "application/x-www-form-urlencoded; charset=UTF-8" objHTTP.Send ("") strResponse = objHTTP.responseText Is there any way to retrieve the page with the special characters intact? Note: I have also tried using this request header with no success: objHTTP.setRequestHeader "Content-Type",

How to compare non english characters with accents

不羁岁月 提交于 2019-11-29 13:11:05
I want to compare 2 strings which have some non English character in them String1 = debarquer String2 = débárquér On comparing above 2 strings, they should say equal. Use the Collator class. It allows you to set a strength and locale and it will compare characters appropriately. It should be something similar to this (NOTE: I have not tested the program) import java.text.Collator; import java.util.Locale; public class CollatorExp { public static void main(String[] args) { Collator collator = Collator.getInstance(Locale.FRENCH); collator.setStrength(Collator.PRIMARY); if (collator.compare(

Reading signs like č ć đ š ž from MySql database

橙三吉。 提交于 2019-11-29 12:27:19
I have problems reading signs 'č', 'ć', 'đ', 'š', 'ž' from MySQL database. I have tried few suggestions that I found on the internet, but none worked. I am looking for correct combination of charset in the database and in PHP file. So far I have always used UTF. Use SET CHARACTER SET 'utf8' before querying any data. http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html Set table and db charset, collation, etc. to utf8_general_ci After establishing connection from php, be sure to do SET NAMES UTF8 . That step is very important. Make sure you saved all PHP files using utf-8 encoding