Re: BText and Unicode-encoded characters

Denny Chambers <[email protected]>
Newsgroups gmane.comp.java.enhydra.barracuda.general
Message-ID <[email protected]>
I think Jacob and Christian are on to something. Check out this little 
test using swing.

If i run this code on the command line:

TextOut.java
==========================================================
import java.util.*;

public class TextOut{

    public static void main(String[] args){
        Locale.setDefault(new Locale("el", "GR"));
        
System.out.println("\u03a3\u03c5\u03bd\u03ac\u03b8\u03c1\u03bf\u03b9\u03c3\u03b7");
    }
}
============================================================

The output is ??????????

But if I use swing, which has the font support I need to render the text 
properly everything look OK, I think, I can definetly say that this is 
all Greek to me.

Try this simple code.

TextOutUI.java
=============================================================
import java.util.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class TextOutUI extends JFrame{

    public TextOutUI(){
        Container container = this.getContentPane();
        container.add(new 
JLabel("\u03a3\u03c5\u03bd\u03ac\u03b8\u03c1\u03bf\u03b9\u03c3\u03b7"));
        this.addWindowListener(
            new WindowAdapter(){  // Quits the Program
                public void windowClosing(WindowEvent event){
                    System.exit(0);
                }
            }
        });
        this.setVisible(true);
    }

    public static void main(String[] args){
        Locale.setDefault(new Locale("el", "GR"));
        TextOutUI to = new TextOutUI();
    }
}
============================================================

hopefully this gives you some insite to your problem.

Denny


Timo H Jarvinen wrote:

> Thanks, Christian. Here's an example:
>
> In Java class:
> BText btext = new BText();
> btext.setAllowMarkupInText(true);
> btext.setText("\u03a3\u03c5\u03bd\u03ac\u03b8\u03c1\u03bf\u03b9\u03c3\u03b7");
>
> a) Character output:
> ??????????
>
> b) Should be:
> &#931;&#965;&#957;&#940;&#952;&#961;&#959;&#953;&#963;&#951;
>
> Timo
>
>
> At 09:48 11.2.2003 -0500, Christian Cryder wrote:
>
>> Hi Timo!
>>
>> > Barracuda components seem to work fine with Unicode-encoded
>> > characters most of the time. However, the BText component
>> > doesn't work. It renders question marks (?) in place of Greek
>> > characters.
>>
>> I'm sure that we will be able to fix this...what I need to know from 
>> you is
>>
>> a) what is actually being rendered (ie. character output)
>> b) what _should_ it be
>>
>> If you can provide a simple example here, showing us the target piece of
>> markup, the BTExt element in question (ie. what data you are putting 
>> into
>> it), and then show us what is coming out along with what it _should_ be
>> instead, that we will be able to fix this.
>>
>> Christian
>>
>> ----------------------------------------------
>> Christian Cryder [[email protected]]
>> Internet Architect, ATMReports.com
>> Barracuda - http://barracudamvc.org
>> ----------------------------------------------
>> "Coffee? I could quit anytime, just not today"
>>
>> > -----Original Message-----
>> > From: [email protected]
>> > [mailto:[email protected]]On Behalf Of Timo H Jarvinen
>> > Sent: Tuesday, February 11, 2003 8:39 AM
>> > To: [email protected]
>> > Subject: [Barracuda] BText and Unicode-encoded characters
>> >
>> >
>> > Hi,
>> >
>> > We are using Barracuda 1.1 final release in a multilingual web
>> > application.
>> > We are not using Localize2, because it seemed too difficult a year 
>> ago.
>> > Rather, we are using Java's resource bundles in language versioning of
>> > texts. Some texts are also hard-coded in Java classes, some are 
>> stored in
>> > the database. We have converted Greek texts into Unicode-encoded
>> > characters
>> > (\udddd) using the native2ascii utility.
>> >
>> > Barracuda components seem to work fine with Unicode-encoded
>> > characters most
>> > of the time. However, the BText component doesn't work. It
>> > renders question
>> > marks (?) in place of Greek characters.
>> >
>> > Is there something we could do better, or is there something
>> > wrong with the
>> > BText component?
>> >
>> > Another issue is that the Greek texts are not displayed in the
>> > Netscape 4.6
>> > and 4.7 browsers. Internet Explorer displays them correctly.
>> > Probably this
>> > is not a Barracuda-related issue.
>> >
>> > Best regards,
>> >
>> > Timo Järvinen
>> > VTT Information Technology
>> > Finland
>> >
>> > _______________________________________________
>> > Barracuda mailing list
>> > [email protected]
>> > http://barracudamvc.org/lists/listinfo/barracuda
>>
>> _______________________________________________
>> Barracuda mailing list
>> [email protected]
>> http://barracudamvc.org/lists/listinfo/barracuda
>
>
> _______________________________________________
> Barracuda mailing list
> [email protected]
> http://barracudamvc.org/lists/listinfo/barracuda
>
>
smime.p7s (application/x-pkcs7-signature, 3.4 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.