Questions tagged [illegal-characters]

any of various circumstances where an invalid or unexpected token causes errors, or otherwise invalidates a data stream

Overview

Illegal characters refers to any of various circumstances where an invalid or unexpected token causes errors, or otherwise invalidates a data stream.

In this context, a token could be a keyword, an operator, or a punctuation mark.

In this context, an error could be any circumstance that violates an established processing rule or convention, such as the syntax rules for a programming language, or the encoding rules for a specific file type.

See also

146 questions
274
votes
11 answers

No visible cause for "Unexpected token ILLEGAL"

I'm getting this JavaScript error on my console: Uncaught SyntaxError: Unexpected token ILLEGAL This is my code: var foo = 'bar';​ It's super simple, as you can see. How could it be causing a syntax error?
bfavaretto
  • 71,580
  • 16
  • 111
  • 150
78
votes
5 answers

Why am I getting X. in my column names when reading a data frame?

I asked a question about this a few months back, and I thought the answer had solved my problem, but I ran into the problem again and the solution didn't work for me. I'm importing a CSV: orders <- read.csv("", sep=",", header=T,…
mikebmassey
  • 8,354
  • 26
  • 70
  • 95
56
votes
8 answers

What characters allowed in file names on Android?

What special characters are allowed for file names on Android? ~!@#$%^&*()_+/\., Also, can I save file with Unicode name?
alex2k8
  • 42,496
  • 57
  • 170
  • 221
47
votes
5 answers

How to remove bad path characters in Python?

What is the most cross platform way of removing bad path characters (e.g. "\" or ":" on Windows) in Python? Solution Because there seems to be no ideal solution I decided to be relatively restrictive and did use the following code: def remove(value,…
Martin
  • 10,738
  • 14
  • 59
  • 67
46
votes
4 answers

Specifying column names in a data.frame changes spaces to "."

Let's say I have a data.frame, like so: x <- c(1:10,1:10,1:10,1:10,1:10,1:10,1:10,1:10,1:10,1:10) df <- data.frame("Label 1"=x,"Label 2"=rnorm(100)) head(df,3) returns: Label.1 Label.2 1 1 1.9825458 2 2 -0.4515584 3 3 …
Brandon Bertelsen
  • 43,807
  • 34
  • 160
  • 255
44
votes
2 answers

Replace chars if not match

I'm looking for a regular expression that removes illegal characters. But I don't know what the characters will be. For example: In a process, I want my string to match ([a-zA-Z0-9/-]*). So I would like to replace all characters that don't match the…
LarZuK
  • 746
  • 1
  • 8
  • 16
39
votes
9 answers

How do I check for illegal characters in a path?

Is there a way to check if a String meant for a path has invalid characters, in .Net? I know I could iterate over each character in Path.InvalidPathChars to see if my String contained one, but I'd prefer a simple, perhaps more formal, solution. Is…
Mike Pateras
  • 14,715
  • 30
  • 97
  • 137
34
votes
3 answers

Valid characters for URI schemes?

I was thinking about Registering an Application to a URL Protocol and I'd like to know, what characters are allowed in a scheme? Some examples: h323 (has numbers) h323:[@][:][;] z39.50r (has a . as…
31
votes
2 answers

Illegal Character error: '\u200b'

I'm making an Asteroid Field for an Asteroid Game in my Object Oriented Programming class and I am receiving an illegal character error: '\u200b'. The issue seems to be happening on line 12. (The line between import java.awt.Point; and public class…
Leopold Stoich
  • 467
  • 1
  • 4
  • 11
20
votes
6 answers

In PHP when submitting strings to the database should I take care of illegal characters using htmlspecialchars() or use a regular expression?

I am working on a form with the possiblity for the user to use illegal/special characters in the string that is to be submitted to the database. I want to escape/negate these characters in the string and have been using htmlspecialchars(). However,…
Brook Julias
  • 2,085
  • 9
  • 29
  • 44
16
votes
3 answers

How to detect illegal UTF-8 byte sequences to replace them in java inputstream?

The file in question is not under my control. Most byte sequences are valid UTF-8, it is not ISO-8859-1 (or an other encoding). I want to do my best do extract as much information as possible. The file contains a few illegal byte sequences, those…
user85155
  • 1,370
  • 16
  • 24
14
votes
2 answers

Select multiple columns with dplyr::select() with numbers as names

Let's say I have the following data frame: a <- runif(10) dd <- as.data.frame(t(a)) names(dd) <- c("ID", "a", "a2", "b", "b2", "f", "XXX", "1", "4", "8") In dplyr, there is a nice way to select a number of columns. For example, to select the…
Theodor
  • 986
  • 3
  • 7
  • 23
14
votes
1 answer

XML (de)serialization invalid string inconsistent in c#?

In C# (.net 4.0 and 4.5 / vs2010 and vs12) when I serialize an object containing a string having an illegal character using XMLSerializer, no error is thrown. However, when I deserialize that result, an "invalid character" error is thrown. …
Robbie
  • 715
  • 3
  • 10
  • 18
12
votes
1 answer

Remove illegal characters while saving workbook Excel VBA

this code basically reformats an xls file and saves it as an xlsx. however it uses G2 & H2 to grab the filename for the newly formatted file. So that means certain characters can't be in the file name. I added a chunk of code to replace those…
Alberto Brown
  • 345
  • 1
  • 7
  • 24
8
votes
3 answers

Why does Python (IronPython) report "Illegal characters in path" when the word bin is used?

I am getting an "Illegal characters in path" error when doing chdir commands in Iron Python. This is happening in run time with my code, but even in the Iron Python console it has this issue. I'm using the nt module because in code the os module…
Mike
  • 728
  • 1
  • 7
  • 27
1
2 3
9 10