You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by boraldo <bo...@hotbox.ru> on 2010/12/15 12:12:35 UTC
"IllegalArgumentException: Illegal character" for utf-8 symbols
Here is my code:
public class BarcodeService
{
private static final int DPI = 100;
public static void generate(OutputStream outputStream, String message)
throws IOException
{
AbstractBarcodeBean bean = new Code128Bean();
bean.setModuleWidth(UnitConv.in2mm(1.0f / DPI));
bean.doQuietZone(false);
BitmapCanvasProvider canvas =
new BitmapCanvasProvider(outputStream, "image/jpeg", DPI,
BufferedImage.TYPE_BYTE_BINARY, false, 0);
bean.generateBarcode(canvas, message);
canvas.finish();
}
public static void main(String[] args) throws IOException
{
generate(new FileOutputStream("C:/1.png"), "йцу");
}
}
"йцу" are russian symbols in utf-8. These leads to
java.lang.IllegalArgumentException: Illegal character: й
How can I get rid of it ?
--
View this message in context: http://old.nabble.com/%22IllegalArgumentException%3A-Illegal-character%22-for-utf-8-symbols-tp30462881p30462881.html
Sent from the FOP - Users mailing list archive at Nabble.com.
Re: "IllegalArgumentException: Illegal character" for utf-8 symbols
Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Sorry, wrong list. Barcode4J support is available at:
barcode4j-users@lists.sourceforge.net
Anyway, Code 128 doesn't support Unicode. Only the US-ASCII character
set is supported. See:
http://en.wikipedia.org/wiki/Code_128
http://barcode4j.sourceforge.net/2.1/symbol-code128.html
On 15.12.2010 12:12:35 boraldo wrote:
>
> Here is my code:
>
> public class BarcodeService
> {
> private static final int DPI = 100;
>
> public static void generate(OutputStream outputStream, String message)
> throws IOException
> {
> AbstractBarcodeBean bean = new Code128Bean();
>
> bean.setModuleWidth(UnitConv.in2mm(1.0f / DPI));
> bean.doQuietZone(false);
>
> BitmapCanvasProvider canvas =
> new BitmapCanvasProvider(outputStream, "image/jpeg", DPI,
> BufferedImage.TYPE_BYTE_BINARY, false, 0);
>
> bean.generateBarcode(canvas, message);
> canvas.finish();
>
> }
>
> public static void main(String[] args) throws IOException
> {
> generate(new FileOutputStream("C:/1.png"), "йцу");
> }
> }
>
>
> "йцу" are russian symbols in utf-8. These leads to
> java.lang.IllegalArgumentException: Illegal character: й
> How can I get rid of it ?
> --
> View this message in context: http://old.nabble.com/%22IllegalArgumentException%3A-Illegal-character%22-for-utf-8-symbols-tp30462881p30462881.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
Jeremias Maerki
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org