How to write the comment symbol in a string

I know there is usually a trick to writing things such as this, but I thougth one of you might have a quick answer:
Error Code:

client.println("Accept: text/html, application/xhtml+xml, */*");

Error:

java.lang.RuntimeException: Missing the */ from the end of a /* comment */
	at processing.app.Sketch.scrubComments(Sketch.java:1719)
	at processing.app.preproc.PdePreprocessor.writePrefix(PdePreprocessor.java:105)
	at processing.app.Sketch.preprocess(Sketch.java:1390)
	at processing.app.Sketch.preprocess(Sketch.java:1339)
	at processing.app.Sketch.build(Sketch.java:1585)
	at processing.app.Sketch.build(Sketch.java:1567)
	at processing.app.Editor$DefaultRunHandler.run(Editor.java:1897)
	at java.lang.Thread.run(Thread.java:619)

Perhaps adding the '' character will help:

client.println("Accept: text/html, application/xhtml+xml, */\*");

If that doesn't work, you can use the fact that two adjacent quoted strings are merged:

client.println("Accept: text/html, application/xhtml+xml, */" "*");

In both cases the idea is to hide the "/*" token from the java code that doesn't have the sense to skip over string constants.

Characters can be represented in octal as \nnn or in hex as \xnn, so

    Serial.println("Accept: text/html, application/xhtml+xml, *\x2F*");
    // or
    Serial.println("Accept: text/html, application/xhtml+xml, *\057*");

Thank you, I changed it to:

client.println("Accept: text/html, application/xhtml+xml, " "*" "/" "*");

The forward slash said incorrect escape code, but it did work for then i need to put " in strings, or char[].

@Jack, is there a list somewhere, ASCII?

napkinsterror:
@Jack, is there a list somewhere, ASCII?

Many places, including the Arduino IDE, File > Examples > 04.Communication > ASCIITable.

Try this (click).

I was just asking if they WERE ascii codes. I know the ascii code and where to find them, just wanted to make sure they corresponded that way.

Has anyone filed this as a bug? This is not good behaviour, and is not valid C, which ignores comment tokens in quoted strings.

Well, if you are going to raise a flag about Serial.print() being not valid C you will have a huge list of issues to go with it, not just this. I don't see how you can complain about a wrapper routine being not "C-like" though. It's just a routine that has a subset of printf()' s parameter abilities. If you need printf() compatibility, then I guess you should use printf(), or maybe use sprintf() before you pass the string text to Serial.print().

KeithRB:
Has anyone filed this as a bug? This is not good behaviour, and is not valid C, which ignores comment tokens in quoted strings.

Someone else hit the bug back in January 04, 2012:
http://forum.arduino.cc/index.php?topic=85818.msg642723

Looks like they reported the bug at Google Code Archive - Long-term storage for Google Code Project Hosting. as number 817:
Google Code Archive - Long-term storage for Google Code Project Hosting.

Another place to report bugs might be: Issues · arduino/Arduino · GitHub

I am not complaining about different functions or functionality, but basic C parsing states that comments are ignored in quoted strings.

KeithRB:
I am not complaining about different functions or functionality, but basic C parsing states that comments are ignored in quoted strings.

Yes, the Sketch.scrubComments function is clearly not playing by the same rules as the compiler when parsing comments.

As an experiment I put:

char *TOP = "/*";

at the top of a sketch and :

char *BOTTOM = "*/";

at the bottom.

No error.

I took out the BOTTOM line and got the error.

I added a /* */ line at the bottom and got no error again. Looks like another work-around is to put / somewhere in the code after the /.

I don't know why the sketch.scrubComments() function exists.

johnwasser:
I don't know why the sketch.scrubComments() function exists.

I would say lack of sufficiently critical peer review.

I would say lack of sufficiently critical peer review.

I fixed that for you.

I don't know why the sketch.scrubComments() function exists.

It's probably needed to run the auto-formatting.