0

We have a record in SQL database, which contains a ASCII 26 character:

SELECT char(26)

From the looking, it's like a arrow, which we can see it in the Eclipse debugging. However, when we try to output it to HTML front-end, it just skipped that character. What's more strange is, the arrow does appear in page source.

It seems 26 belongs to control characters. So is it possible to display the arrow in HTML? Why some place like the debugging window of Eclipse can show it well?

Jerry Bian
  • 3,998
  • 6
  • 29
  • 54
  • (Not addressing your problem at all, just your collection of facts…)You'd better check on that field definition (and table and database configuration, if applicable) again. It's very doubtful that the datatype is a form of text with an ASCII encoding. In any specific context, there is exactly one character encoding, and it's best to know what it is. – Tom Blodget Aug 12 '16 at 23:46
  • Given that HTML uses Unicode (regardless of the document encoding), you might wish to use the Control Pictures listed [here](http://www.unicode.org/charts/nameslist/index.html) as substitutes for control characters. – Tom Blodget Aug 12 '16 at 23:48
  • @TomBlodget I have already specified the question even in title, and the body shows what I have researched. Isn't that? – Jerry Bian Aug 13 '16 at 02:00

1 Answers1

1

It's a control character, unprintable by definition. Some character sets (or fonts, not sure which determines that) do print control characters; Unicode is not one of them. See Browser Test Page for Unicode Character 'SUBSTITUTE' (U+001A).

Decide what you actually want to display, and replace this character with an actually printable Unicode character.

You could for example use →, →, Unicode Character 'RIGHTWARDS ARROW' (U+2192).

CodeCaster
  • 147,647
  • 23
  • 218
  • 272
  • Thanks. But I am wondering why some UI such as Eclipse debugging window can show it well, does it also replace with some else character? – Jerry Bian Aug 13 '16 at 01:58
  • @Jerry Debuggers' data visualization are value-added but sometime distorting. It is reasonable for a debugger, when showing what is most likely text, to show non-printable characters by substituting printable ones. The reason for U+2192 is chosen is involved in the the history of [CP437](https://en.wikipedia.org/wiki/Code_page_437), or, for some reason, you have a setting for CP437 or similar somewhere. – Tom Blodget Aug 14 '16 at 15:11