RE: unicode problem

2002-05-16 Thread Argyn Kuketayev
Unicode is Ok in your example. I guess, your issue is with fonts.

 -Original Message-
 From: Henrik Holle [mailto:[EMAIL PROTECTED]
 Sent: Thursday, May 16, 2002 10:46 AM
 To: [EMAIL PROTECTED]
 Subject: unicode problem
 
 
 hi,
 
 i have an java string with an greek alpha letter.  i do not 
 know how to
 convert the java unicode string so that i can display
 it with fop
 
 
 i need something like:
   fo:inline  font-family=Symbol  
 font-size=7pt#x03B1;/fo:inline
 


Re: unicode problem

2002-05-16 Thread J.Pietschmann
Henrik Holle wrote:
i have an java string with an greek alpha letter.  i do not know how to
convert the java unicode string so that i can display
it with fop
i need something like:
fo:inline  font-family=Symbol  font-size=7pt#x03B1;/fo:inline
You have at least two options:
1. Let the Java library write a stream in an encoding which
is understood by an XML parser. Look at the documentation for
java.io.OutputStreamWriter for this purpose. Create one with
UTF-8 or perhaps another UTF encoding, like
 w=new java.io.OutputStreamWriter(new FileOutputStream(f.xml),UTF-8)
 w.write(theString,0,theString.length());
Be sure to put an XML declaration in front with either
encoding=UTF-8 or no encoding specification at all (UTF-8
can be autodetected). There is an overwiev of character
encoding handling in Java on the package summary for java.lang.
2. Print the XML character references yourself. This isn't hard
(assuming your default character encoding is ASCII or an ASCII
extension like ISO-8859).
 for( int i=0;itheString.length();i++ ) {
  char c=theString.charAt(i);
  int ci=(int)c;
  if( ci=127 ) {
   System.out.print(c);
  } else {
   System.out.print(#+ci+;);
  }
 }
J.Pietschmann