Hi, can you check if the bxml file has the UTF-8 encoding specified (at the top
of the file):
<?xml version="1.0" encoding="utf-8"?>
And then can you check if the characters are actually encoded as UTF-8 in the
file (or if they are in one of the double-byte Chinese encodings)?
Is this on Windows or Linux or OSX?
Here is a little program that can read a file and check for a valid encoding.
To use it, do "javac CharsetCheck.java" then "java CharsetCheck filename" (you
can use "java CharsetCheck -charsetname filename*" to specify another character
set to use.
~Roger Whitcomb
CharsetCheck.java
-----------------
import java.io.*;
import java.nio.charset.*;
public class CharsetCheck
{
private static Charset charset = null;
private static void displayHelp() {
System.out.println("Usage: java CharsetCheck [-charset]
file_name*");
}
public static void main(String[] args) {
if (args.length == 0) {
displayHelp();
return;
}
// Check for charset name
for (String arg : args) {
String name = null;
if (arg.startsWith("--")) {
name = arg.substring(2);
}
else if (arg.startsWith("-")) {
name = arg.substring(1);
}
if (name != null) {
try {
charset = Charset.forName(name);
}
catch (IllegalCharsetNameException ex1) {
System.err.format("Illegal charset name: '%1$s'%n",
name);
}
catch (UnsupportedCharsetException ex2) {
System.err.format("Unsupported charset: '%1$s'%n",
name);
}
}
}
// Use default charset of UTF-8 if none given
if (charset == null) {
charset = Charset.forName("UTF-8");
}
// Now loop through all the files specified
for (String arg : args) {
if (!arg.startsWith("-")) {
File file = new File(arg);
if (file.exists() && file.isFile() && file.canRead()) {
long inputPos = 0L;
InputStreamReader reader = null;
int ch = 0;
try {
FileInputStream fis = new FileInputStream(file);
CharsetDecoder decoder = charset.newDecoder();
decoder.onUnmappableCharacter(CodingErrorAction.REPORT);
decoder.onMalformedInput(CodingErrorAction.REPORT);
reader = new InputStreamReader(fis, decoder);
while ((ch = reader.read()) != -1)
inputPos++;
System.out.format("File '%1$s' appears to be
correctly encoded in '%2$s' charset.%n", arg, charset.name());
}
catch (CharacterCodingException cce) {
System.out.format("Character coding exception:
%1$s, previous character is '0x%2$x'%n at offset 0x%3$x in file '%4$s'%n",
cce.getMessage(), ch, inputPos+1, arg);
}
catch (IOException ioe) {
System.out.format("I/O exception: %1$s%n at offset
%2$d in file '%3$s'%n", ioe.getMessage(), inputPos, arg);
}
finally {
try {
if (reader != null)
reader.close();
}
catch (IOException ignore) { }
}
}
else {
System.err.format("Cannot find or read the file
'%1$s'!%n", arg);
}
}
}
}
}
-----Original Message-----
From: Jiaojiao [mailto:[email protected]]
Sent: Monday, May 28, 2012 8:32 PM
To: [email protected]
Subject: Re: add Meter to TableView.column
Hi Sandro,
Thank you for your answer.
For adding Chinese contents in bxml files,I use sentences as follows:
<ListButton bxml:id="listButton" styles="{font:'SimSun 15'}"
listData="['电影', '电视剧', '综艺节目']"/>
But there is an ParseError:1bytes of UTF-8 sequence of bytes1 invalid.
Is there anything wrong?
--
View this message in context:
http://apache-pivot-users.399431.n3.nabble.com/add-Meter-to-TableView-column-tp4004544p4020067.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.