Dan,

 Many thanks for timely assistance. It solved my problems.

best regards,

mp


Daniel Wunsch <the.gray@gmx.net>
Sent by: beanshell-users-admin@lists.sourceforge.net

09/14/2005 12:14 PM

To
beanshell-users@lists.sourceforge.net
cc
Subject
Re: [Beanshell-users] UTF-8 Strings





hi

> It appears the source() command read the file as ASCII, and hence any high
> byte data is lost on strings, even if the editor being used dispalys it.
> Is there a way to preserve the UTF-8 info while using the source command?

the source command uses the platform default encoding,
so you can run into nice little problems if you try to use
it in a script you want to use on different platforms.

use something like this instead:

/** source an UTF-8 encoded URL-content into the caller */
public sourceUTF8(URL url) {
   var in  = new InputStreamReader(url.openStream(), "UTF-8");
   this.interpreter.eval(in, this.caller.namespace, "URL: "+url.toString());
   in.close();
}

daniel


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Beanshell-users mailing list
Beanshell-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/beanshell-users