Search code examples
javaunicodeescapingjavadocunicode-escapes

Escape unicode escaping within Javadoc


I'm writing Javadoc for a class explaining proper unicode escaping:

 * String unitAbbrev = "μs"; //Best: perfectly clear even without a comment.
 * String unitAbbrev = "\u03bcs"; //Poor: the reader has no idea what this is.

Unfortunately they both render with "μs":

enter image description here

Is there any way to escape this unicode escape?

Double backslash ("\\u03bcs") doesn't work:

enter image description here


Solution

  • Try putting the escaped Unicode literal for the backslash itself, I think:

    \u005c