Questions tagged [invalid-characters]

168 questions
733
votes
4 answers

Why aren't ◎ܫ◎ and ☺ valid JavaScript variable names?

I noticed that in Internet Explorer (but, unfortunately, not in the other browsers I tested), you can use some Unicode variable names. This made my day, and I was absolutely delighted that I could write fun Unicode-laden code like this: var…
Peter Olson
  • 121,487
  • 47
  • 188
  • 235
183
votes
13 answers

C# Sanitize File Name

I recently have been moving a bunch of MP3s from various locations into a repository. I had been constructing the new file names using the ID3 tags (thanks, TagLib-Sharp!), and I noticed that I was getting a System.NotSupportedException: "The…
Jason Sundram
  • 10,998
  • 19
  • 67
  • 84
75
votes
8 answers

Valid characters in a Java class name

What characters are valid in a Java class name? What other rules govern Java class names (for instance, Java class names cannot begin with a number)?
Zach
  • 2,075
  • 2
  • 17
  • 32
24
votes
9 answers

removing invalid XML characters from a string in java

Hi i would like to remove all invalid XML characters from a string. i would like to use a regular expression with the string.replace method. like line.replace(regExp,""); what is the right regExp to use ? invalid XML character is everything that is…
yossi
  • 11,822
  • 27
  • 75
  • 110
20
votes
3 answers

What are valid characters for Windows environment variable names and values?

After some reseach, I found out that length limits for names are 255 and for values 32767 characters. But which characters are allowed for names? And which characters are allowed for values?
19
votes
13 answers

Cannot get xslt to output an (&) even after escaping the character

I am trying to create a query string of variable assignments separated by the & symbol (ex: "var1=x&var2=y&..."). I plan to pass this string into an embedded flash file. I am having trouble getting an & symbol to show up in XSLT. If I just type &…
Bill
17
votes
3 answers

Is there a Python library function which attempts to guess the character-encoding of some bytes?

I'm writing some mail-processing software in Python that is encountering strange bytes in header fields. I suspect this is just malformed mail; the message itself claims to be us-ascii, so I don't think there is a true encoding, but I'd like to get…
Nick
  • 18,904
  • 18
  • 43
  • 48
14
votes
5 answers

Base64 String throwing invalid character error

I keep getting a Base64 invalid character error even though I shouldn't. The program takes an XML file and exports it to a document. If the user wants, it will compress the file as well. The compression works fine and returns a Base64 String which…
Brandon
  • 65,640
  • 30
  • 189
  • 218
10
votes
1 answer

cin.clear() doesn't reset cin object

I have the following loop. It should read numbers until EndOfFile, or the user input -999 int arr[100]; int index; for (index = 0; index < 100; index++) { cin >> arr[index]; if (!cin) { cin.clear(); index--; continue; } if (arr[index]…
user586399
9
votes
1 answer

Check for valid utf8 string in Python

I'm reading filenames from file system and I want to send them as JSON encoded array. The problem is that files on file system can be stored in invalid encoding, and I need to handle this situation to omit invalid filenames before passing it to…
troex
  • 1,010
  • 1
  • 13
  • 19
9
votes
1 answer

Central way to filter invalid unicode chars in lxml?

It is common knowledge that certain character ranges aren't allowed in XML documents. I'm aware of solutions to filter those characters out (like [1], [2]). Going with the Don't Repeat Yourself principle, I would prefer to implement one of these…
Percival Ulysses
  • 1,113
  • 11
  • 16
7
votes
6 answers

SQL invalid conversion return null instead of throwing error

I have a table with a varchar column, and I want to find values that match a certain number. So lets say that column contains the following entries (except with millions of rows in real life): 123456789012 2345678 3456 23…
Bryce Wagner
  • 2,496
  • 1
  • 23
  • 41
7
votes
2 answers

Parsing invalid ampersands with Android's XmlPullParsers

I am writing a little screen-scraping app that consumes some XHTML - it goes without saying that the XHTML is invalid: ampersands aren't escaped as &. I am using Android's XmlPullParser and it spews out the following error upon the incorrectly…
Leonard Ehrenfried
  • 1,523
  • 2
  • 20
  • 33
6
votes
3 answers

xsl trying to ouput '<' as opposed to '<'

Update: The issue still persists although it is not quite the same as before. Below is an example of what is being input, what is being output and what I want to have output An example of the input: &lt;p&gt;&lt;span…
dudledok
  • 2,620
  • 5
  • 21
  • 34
6
votes
4 answers

Check for invalid input

I'm writing a program that will take a string as an input and check if the elements in it are valid or not. I want my input to only contain lower characters and periods, exclamation marks, and space and not an empty string. If the user enter an…
K.U
  • 273
  • 1
  • 4
  • 13
1
2 3
11 12