You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Hansjörg Meuschel <hj...@gmx.de> on 2006/01/14 19:14:59 UTC

character encoding

Hi, a simple question but I can't find the answer ....

-> How can I convert my data to utf-8 encoding??



I have an outputstream (out of JAXB) and I want to write it as servlet 
response:

        FacesContext faces = FacesContext.getCurrentInstance();       
        HttpServletResponse response = (HttpServletResponse) 
faces.getExternalContext().getResponse();
        response.setContentType("text/xml");
        response.setHeader("Content-disposition","attachment; filename=...
         while (Reader.ready()) {
               response.getOutputStream().println(Reader.readLine());    
                      ################### here I need the encoding
          }

        response.getOutputStream().flush();
        faces.responseComplete();
       Reader.close();

.. all of this works fine, the only problem I have is with the character 
encoding

Greets, Hans



Re: character encoding

Posted by Hansjörg Meuschel <hj...@gmx.de>.
Hi, just to complete the posting: i found a solution for this:
now I write to a bufferedwriter(new 
outputstreamwriter(response.getoutputstream())) - this does it :-)

> Hi, a simple question but I can't find the answer ....
>
> -> How can I convert my data to utf-8 encoding??
>
>
>
> I have an outputstream (out of JAXB) and I want to write it as servlet 
> response:
>
>        FacesContext faces = FacesContext.getCurrentInstance();       
>        HttpServletResponse response = (HttpServletResponse) 
> faces.getExternalContext().getResponse();
>        response.setContentType("text/xml");
>        response.setHeader("Content-disposition","attachment; filename=...
>         while (Reader.ready()) {
>               
> response.getOutputStream().println(Reader.readLine());    
>                      ################### here I need the encoding
>          }
>
>        response.getOutputStream().flush();
>        faces.responseComplete();
>       Reader.close();
>
> .. all of this works fine, the only problem I have is with the 
> character encoding
>
> Greets, Hans