RE: BText and Unicode-encoded characters

"Christian Cryder" <[email protected]>
Newsgroups gmane.comp.java.enhydra.barracuda.general
Message-ID <[email protected]>
Here's what BTExt does...It delegates to this:
    DOMUtil.setTextInNode((Element) node, text, btext.allowMarkupInText());

Once in DOMUtil, it does this (the relevant part):
    if (allowMarkupInText) newNode =
node.getOwnerDocument().createCDATASection(text);
    else newNode = node.getOwnerDocument().createTextNode(text);

So because you are saying allowMarkup = true, everything gets wrapped in a
CDATA section.

So basically, whatever is happening here is ultimately DOM implementation
specific...either the DOM is creating a CDATA block or the DOM is creating a
text node. If neither one of these is doing the correct thing, then we need
to figure out what to do instead. But my guess is still that if you set
allowMarkup = false, things should work correctly.

Any luck?
----------------------------------------------
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 Shawn Wilson
> Sent: Tuesday, February 11, 2003 11:54 AM
> To: [email protected]
> Subject: Re: [Barracuda] BText and Unicode-encoded characters
>
>
> My experience has been exactly what you suggest Denny: if the font does
> not support the requested unicode characters, the '?' character is used
> in their place.
>
> Okay so that's one point. Now, it sounds like Timo wants something like
> "\u03a3\u03c5" to translate into the HTML entities of "&#931;&#965;".
> Does BText actually do that? If he is getting question marks then BText
> is probably just outputting the literal unicode characters. Does anyone
> know if the servlet spec requires servlet containers to send data in
> 16-bit unicode? If not, and it is sending it in UTF-8, then it would not
> be possible for any literal 16-bit unicode character to get translated
> so it would be lost. Of course, even if a browser receives data in
> 16-bit unicode, I don't even know if they'll display unicode characters
> without them being specified as entities. Anyone else know?
>
> Here is a good page for testing whether your browser supports Unicode,
> along with other links: http://home.att.net/~jameskass/
>
> -shawn
>
> Denny Chambers wrote:
> > 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\u03
> b9\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\u0
> 3c3\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
> >>
> >>
>
> _______________________________________________
> Barracuda mailing list
> [email protected]
> http://barracudamvc.org/lists/listinfo/barracuda
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.