Encoding in Scene Builder

Posted by Agafonova Victoria on Stack Overflow See other posts from Stack Overflow or by Agafonova Victoria
Published on 2012-06-08T16:37:12Z Indexed on 2012/06/08 16:40 UTC
Read the original article Hit count: 549

Filed under:

I generate an FXML file with Scene Builder. I need it to contain some cirillic text. When i edit this file with Scene Builder i can see normal cirillic letters (screen 1) After compileing and running my program with this FXML file, i'll see not cirillic letters, but some artefacts (screen 2) But, as you can see on the screen 3, its xml file encoding is UTF-8. Also, you can see there that it is saved in ANSI. I've tried to open it with other editors (default eclipse and sublime text 2) and they shoen wrong encoding either. (screen 4 and screen 5) At first i've tried to convert it from ansi to utf-8 (with notepad++). After that eclipse and sublime text 2 started display cirillic letters as they must be. But. Scene builder gave an error, when i've tried to open this file with it:

Error loading file 
C:\eclipse\workspace\equification\src\main\java\ru\igs\ava\equification\test.fxml.
C:\eclipse\workspace\equification\src\main\java\ru\igs\ava\equification\test.fxml:1: ParseError 
at [row,col]:[1,1]

Message: Content is not allowed in prolog.

And java compiler gave me an error:

 ??? 08, 2012 8:11:03 PM javafx.fxml.FXMLLoader logException
 SEVERE: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
 Message: Content is not allowed in prolog.
 /C:/eclipse/workspace/equification/target/classes/ru/igs/ava/equification/test.fxml:1
 at javafx.fxml.FXMLLoader.load(Unknown Source)
 at javafx.fxml.FXMLLoader.load(Unknown Source)
 at javafx.fxml.FXMLLoader.load(Unknown Source)
 at javafx.fxml.FXMLLoader.load(Unknown Source)
 at javafx.fxml.FXMLLoader.load(Unknown Source)
 at javafx.fxml.FXMLLoader.load(Unknown Source)
 at ru.igs.ava.equification.EquificationFX.start(EquificationFX.java:22)
 at com.sun.javafx.application.LauncherImpl$5.run(Unknown Source)
 at com.sun.javafx.application.PlatformImpl$4.run(Unknown Source)
 at com.sun.javafx.application.PlatformImpl$3.run(Unknown Source)
 at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
 at com.sun.glass.ui.win.WinApplication.access$100(Unknown Source)
 at com.sun.glass.ui.win.WinApplication$2$1.run(Unknown Source)
 at java.lang.Thread.run(Unknown Source)

 Exception in Application start method
 Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)
at com.sun.javafx.application.LauncherImpl.access$000(Unknown Source)
at com.sun.javafx.application.LauncherImpl$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
 Caused by: javafx.fxml.LoadException: javax.xml.stream.XMLStreamException: ParseError at    
 [row,col]:[1,1]
 Message: Content is not allowed in prolog.
at javafx.fxml.FXMLLoader.load(Unknown Source)
at javafx.fxml.FXMLLoader.load(Unknown Source)
at javafx.fxml.FXMLLoader.load(Unknown Source)
at javafx.fxml.FXMLLoader.load(Unknown Source)
at javafx.fxml.FXMLLoader.load(Unknown Source)
at javafx.fxml.FXMLLoader.load(Unknown Source)
at ru.igs.ava.equification.EquificationFX.start(EquificationFX.java:22)
at com.sun.javafx.application.LauncherImpl$5.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl$4.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl$3.run(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(Unknown Source)
at com.sun.glass.ui.win.WinApplication$2$1.run(Unknown Source)
... 1 more
    Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
    Message: Content is not allowed in prolog.
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(Unknown Source)
at javax.xml.stream.util.StreamReaderDelegate.next(Unknown Source)
... 14 more

So, i've converted it back to ANSI. And, having this file in ANSI, changed its "artefacted" text to cirillic letters manually. Now i can see normal text when i run my program, but when i open this fixed file via Scene Builder, Scene Builder shows me some "artefacted" text (screen 7). So, how can i fix this situation?

© Stack Overflow or respective owner

Related posts about javafx-2