1 Reply Latest reply on Jun 6, 2010 6:31 AM by Kayaman

    handling the BOM character


      I have designed a set of user interface components (HTML).

      I have decided to break them up with JSP Tag Files (note that I am talking about JSP tag files, not tag handlers coded in Java).
      So I have this tag which writes its own body, via
      In case its body is the output of another tag.. the server outputs the BOM character of the inner tag file along the real body content.
      And GUI breaks up, because the BOM character appears between HTML tags in the HTTP response, and fuc*ks up everything - GUI parts appear as if there was padding.... where really there is
      css-selector {
      And this happens whenever I use tag files, whether or not they are nested, but in the nested ones the problem compounds.

      What should I do to avoid this nasty char ?

      Anyway when I go for
      <jsp:doBody var="bodyVar"/> 
      then the bodyVar actually contains lots of spaces and a BOM character (multiple ?) along with the real content... (I have examined the char codes of the string)

      I am using NetBeans and whenever I copy a physical tag file (to fork it and finally come up with a new tag with new semantics) it appears that NetBeans adds a BOM character for each successive copy I make (of the last copy in the chain).

      I am really confused.

      In short - the problem is that the BOM char in the Java/JSP source code file goes into the HTML code and messes with its semantics.

      What should I do ?

      [Link to image|http://img263.imageshack.us/img263/313/boms.jpg]
        • 1. Re: handling the BOM character
          Which encoding are you using?
          Some workarounds would be to switch to one of the encodings that don't use BOM, such as UTF-16BE/LE.
          Of course that's not an optimal solution really.

          NetBeans and Java is to blame I guess, since a few months ago it was established that Java's streams don't handle BOM correctly. Code was provided for a stream that knows how to ignore the BOM, but it's not like you can get NetBeans to use that...