Alex Kizub <> wrote in message news:<>...
> Fritz:
> Convertion from utf-8 to unicode is Java loalization privilege.
> So, let Java do what it supposed to do.
>
> public class a{
> public static void main(String []a) throws Exception {
> java.text.DecimalFormat f;
> f = new java.text.DecimalFormat();
> f.applyPattern("\\u0000");
>
> java.io.FileReader fr=new java.io.FileReader("a.java");
> while (fr.ready()) {
> System.out.println(f.format(fr.read()));
> }
> fr.close();
> }
> }
>
> Alex Kizub.
>
> Fritz Bayer wrote:
>
> > Hi,
> >
> > I'm looking for a little program, which reads utf-8 data from a file
> > and writes it in the form of unicode escape into another text file.
> >
> > Why am I looking for something like this? Well, I have a file which
> > contains utf-8 encoded data.
> >
> > That data I would like to build staticly into my program. So I would
> > like to copy and paste it into a String constant (String
> > ="\uxxxx\uxxxx...").
> >
> > However, since I can't just open up a viewer and copy and paste the
> > contents (of course), I would have to convert it into unicode escape.
> >
> > Then I could copy and paste those escape code into my program. I
> > thought that their must be some source code / program aroung which
> > does that?
> >
> > Fritz
Thank you Alex. I`m experience a small problem so. Some of the escapes
look like:
\u65533
ie they are too long. I also noticed that none of the escapes contain
hexadecimal, which seems to be wrong since unicode escapes contain
them.
|