My FXML file is formatted in UTF-8. This is the relevant part of code:
<?xml version="1.0" encoding="UTF-8"?>
<Text fx:id="totalSqMGlassText" layoutX="573.0" layoutY="547.0" strokeType="OUTSIDE" strokeWidth="0.0" text="�xB2;" AnchorPane.bottomAnchor="57.0" AnchorPane.leftAnchor="573.0" />
I checked the UTF-8 code for second power here and here. Found this information about Unicode character "superscript two", i.e. the second power: "UTF-8 (hex) - 0xC2 0xB2 (c2b2)". I also read this question and answer on stackOverflow. So I tried with these:
�xC2;
e�xB2;
슲
&#c2b2;
and even this :)
&#c2 b2;
If I use standard text everything works fine but if I try with the aforementioned special character and escaping I receive this exception:
javafx.fxml.LoadException:
...
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[142,121]
Message: The character reference must end with the ';' delimiter.
or this
Caused by: javax.xml.stream.XMLStreamException: ParseError at
[row,col]:[142,118]
Message: A decimal representation must immediately follow the "&#" in a character reference.
Each time I used semicolon (once I tried even without semicolon and with two semicolons :)). I think the second exception is obvious. In my desperation I simply tried few times to enter the right escaping blindly so I used escaping for decimal representation instead for hexadecimal (correct me if I'm wrong). So my question is:
Do you know what am i doing wrong and what is the right escaping and code in that situation? And also what is the right way to represent powers and exponents through FXML/XML in general? Thank you in advance.
Replace �xB2;
with ²
for Unicode SUPERSCRIPT TWO
(²).