Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

The rules for escaping special characters in this forum are difficult impossible to fathom.

For example, the DELIMITED BY slash-x09 must be coded with two slashes in the PRE section in this question: http://sqlanywhere-forum.sap.com/questions/12518/how-do-i-refer-to-the-same-openstring-file-twice-in-one-query

but with only one slash in the PRE section of this answer: http://sqlanywhere-forum.sap.com/questions/12518/how-do-i-refer-to-the-same-openstring-file-twice-in-one-query/12540

This is only one example of many... sometimes stuff doesn't need to be escaped (underscores, asterisks), sometimes it doesn't.

For example the asterisk in SELECT v_property.* needed escaping in the question linked above, but not in the answer... and right now I cannot seem to create an example of PRE where it DOES need escaping.


IMO pre-formatted text is sacrosanct... special highlighting features are acceptable ONLY IF THEY ARE PERFECTLY IMPLEMENTED... if special features have any flaws whatsoever, they should be REMOVED ALTOGETHER... code is code, not a Christmas tree.

asked 06 Jul '12, 06:40

Breck%20Carter's gravatar image

Breck Carter
32.5k5417261050
accept rate: 20%

edited 06 Jul '12, 06:48

Just to add:

Another irritation comes from preview: Sometimes the preview implies one has to use escapes (e.g. in bold or italicized text), and the real view does not need it (or was it vice versa)?

FWIW: For shorter code blocks, I usually use 4 blanks instead of using the PRE format tool - I don't know if this leads to different markup code?

(06 Jul '12, 07:20) Volker Barth

I can't tell you exactly why but it's an issue with HTML parsing. The difference between the formatted text in the question and the formatted text in the answer is that there's a blank line before the <pre> in the answer but not in the question. It's the difference between this:

Text
<pre>
Code
</pre>

and this:

Text
<pre> Code </pre>

I suspect that in the first case, the markdown parser doesn't realize it's in a <pre> block so you need to escape the backslash. I've seen this before when you don't leave a blank line before some 4-space-indented code, but I would have expected an explicit <pre> to work.

permanent link

answered 06 Jul '12, 11:19

Graeme%20Perrow's gravatar image

Graeme Perrow
9.6k379124
accept rate: 54%

So you're saying: Add a blank line before any <pre> tag and/or 4-space-indented code, and then the following code should not need escapes?

Then this would be a welcome solution:)

(06 Jul '12, 11:22) Volker Barth

@Graeme: Excellent! an actual answer, as opposed to a denial that the problem exists :)

(06 Jul '12, 11:38) Breck Carter

Hmmm, I had noticed that the question and answered differed in the placement of the <pre> tag - that one had a blank line and the other did not - but when I tried to repro the issue with and without a blank line I did not get any difference. Were you actually able to confirm that that was the difference that caused the different behaviour?

(06 Jul '12, 13:26) Mark Culp
Replies hidden

Yes - check out the internal dev server. I've modified the test question to have two identical copies of the code, one with a blank line before and one without. The first one shows the backslash properly, the second does not.

(06 Jul '12, 13:38) Graeme Perrow

Yep, I see it... I must have done something wrong when I tested it. Thanks for confirming the issue. BTW: What Markdown implementation (and version) does this forum use to generate the html on the backend?

(06 Jul '12, 14:20) Mark Culp

All the OSQA code is python. The forum is using the markdown module for python 2.6, version 2.0.3.

(06 Jul '12, 14:28) Graeme Perrow
showing 3 of 6 show all flat view

As you all likely know, this forum is based on the open source software called OSQA and uses a text formatting system called Markdown. This site does document (some of) the Markdown syntax here.

I'll agree with you that the Markdown syntax can take a bit of effort to learn, but all mark-up syntaxes take effort to learn, and I have (personally) find that Markdown is easier than other ones that I have used (especially some Wiki syntaxes which IMHO are less than wonderful).

The first thing I'll mention (and this has been mentioned in other internet sites that talk about Markdown) is that there are numerous implementations of Markdown. In particular, this site uses a Javascript implementation of Markdown to generate the preview text when you are typing a question or answer. This site also uses a php (I think? ... or is it perl? Graeme can verify) implementation to generate the HTML on the backend when it renders a questions or answer for output on your browser. The issue is that these two implementations are not perfectly exactly the same and therefore you may see some differences between the preview text and the final rendered text.

I've tried to understand why you have seen the differences in the escape requirements in the two pre sections but my offline testing has not repro'ed the issue. :-( '\\x09' vs '\x09' - in fact my testing (on our development system) has shown that the question did not need to use two backslashes when you escaped the sequence. It would appear that it was just a preview vs final-rendered difference (as I mentioned above).


Edit: Note that in typing my response I had to go back and edit my response to escape the second \x09 so that the backslash would show up. A confirmation that the rendering of escape sequences is not the same in the preview and the final answer !

permanent link

answered 06 Jul '12, 09:32

Mark%20Culp's gravatar image

Mark Culp
24.9k10141297
accept rate: 41%

edited 06 Jul '12, 09:34

Personally, I can cope with the Preview/View differences. What might be documented (somewhat) better is the use of HTML tags in Markdown - as asked in my question comment: Is using <PRE> the same as using the Markdown for code (indenting with 4 spaces...)?

In general, the missing/superfluous escapes leave something to edit now and then - not that bad, either:)


FWIW, I had to escape the < and >, too:)

(06 Jul '12, 10:04) Volker Barth
Comment Text Removed
Comment Text Removed
Comment Text Removed
Comment Text Removed
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×178

question asked: 06 Jul '12, 06:40

question was seen: 12,506 times

last updated: 06 Jul '12, 14:28