You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by PeshoChuka <ma...@abv.bg> on 2007/03/07 10:08:27 UTC

MyFaces cyrillic

  Sory if this is not the right place for this posting but i really don't
have an idea and i suspect everything at this moment.
Hi, i am trying to start a simple JSF application that display cyrillic.
The application is exactly one <h:outputtext>. I am using eclipse and i
needed to change the encoding to Windows-1251.

<%@page language="java" pageEncoding="WINDOWS-1251" contentType="text/html;
charset=WINDOWS-1251" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<f:loadBundle basename="resources.application" var="bundle"/>
<f:view>
<html>
<head> 
<h:outputText value="#{bundle['welcome.title']}" />
</head>
<body>
<h:outputText value="#{bundle['welcome.heading']}" />
<h:outputText value="#{bundle['welcome.message']}" />
</body>
</html>
</f:view>

In the browser the cyrrilic is broken. I set the browser encoding to CP1251.
I tryed the same example with UTF8.
I use JBOSS 4.0.5

Thanks for the help. I really try to search the forum for the same problem
but i couldnt find a solution.


-- 
View this message in context: http://www.nabble.com/MyFaces-cyrillic-tf3360867.html#a9349097
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [Solved] MyFaces cyrillic

Posted by PeshoChuka <ma...@abv.bg>.
Yes i change it to:

<%@page language="java" pageEncoding="utf-8" contentType="text/html;
charset=utf-8" %>



Werner Punz-2 wrote:
> 
> also
> 
> <%@page language="java" pageEncoding="WINDOWS-1251"
>>>> contentType="text/html;
>>>> charset=WINDOWS-1251" %>
> 
> if you have not done that change that as well...
> 
> 
> PeshoChuka schrieb:
>>    Thanks for the answere. I used the eclipse to change the encoding of
>> propertyfiles
>> to UTF-8. And also the encoding of JSP files to UTF-8 unfortunatly there
>> is
>> no change in
>> the status. Still only monkeys display. Is it possible the JBoss to
>> interfere somehow?
>> Thanks!
>> 
>> 
>> Werner Punz-2 wrote:
>>> Ok I indeed assume you have an encoding problem, the webpage probably
>>> has a different encoding than your resource file,
>>> but why wincp 1251, utf8 can handle cyrillc to my knowledge...
>>> if it is because you program in windows, eclipse has an encoding setting
>>> for the editors where you can switch encodings (in newer versions the
>>> default encoding has been moved into the file associations).
>>>
>>> It is better to stick with utf8 throghout every possible layer that has
>>> been my experience so far, which means, webpage utf8, resource files
>>> utf8 database utf8, many other charsetzs have browser incompatibilities
>>> or are not supported properly entirely.
>>> (For instance if you go with ISO charsets you run into euro problems on
>>> ie, or general encoding problems on ie forms)
>>>
>>>
>>>
>>> PeshoChuka schrieb:
>>>>   Sory if this is not the right place for this posting but i really
>>>> don't
>>>> have an idea and i suspect everything at this moment.
>>>> Hi, i am trying to start a simple JSF application that display
>>>> cyrillic.
>>>> The application is exactly one <h:outputtext>. I am using eclipse and i
>>>> needed to change the encoding to Windows-1251.
>>>>
>>>> <%@page language="java" pageEncoding="WINDOWS-1251"
>>>> contentType="text/html;
>>>> charset=WINDOWS-1251" %>
>>>> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
>>>> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
>>>> <f:loadBundle basename="resources.application" var="bundle"/>
>>>> <f:view>
>>>> <html>
>>>> <head> 
>>>> <h:outputText value="#{bundle['welcome.title']}" />
>>>> </head>
>>>> <body>
>>>> <h:outputText value="#{bundle['welcome.heading']}" />
>>>> <h:outputText value="#{bundle['welcome.message']}" />
>>>> </body>
>>>> </html>
>>>> </f:view>
>>>>
>>>> In the browser the cyrrilic is broken. I set the browser encoding to
>>>> CP1251.
>>>> I tryed the same example with UTF8.
>>>> I use JBOSS 4.0.5
>>>>
>>>> Thanks for the help. I really try to search the forum for the same
>>>> problem
>>>> but i couldnt find a solution.
>>>>
>>>>
>>>
>>>
>> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/MyFaces-cyrillic-tf3360867.html#a9350011
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [Solved] MyFaces cyrillic

Posted by Werner Punz <we...@gmail.com>.
also

<%@page language="java" pageEncoding="WINDOWS-1251"
>>> contentType="text/html;
>>> charset=WINDOWS-1251" %>

if you have not done that change that as well...


PeshoChuka schrieb:
>    Thanks for the answere. I used the eclipse to change the encoding of
> propertyfiles
> to UTF-8. And also the encoding of JSP files to UTF-8 unfortunatly there is
> no change in
> the status. Still only monkeys display. Is it possible the JBoss to
> interfere somehow?
> Thanks!
> 
> 
> Werner Punz-2 wrote:
>> Ok I indeed assume you have an encoding problem, the webpage probably
>> has a different encoding than your resource file,
>> but why wincp 1251, utf8 can handle cyrillc to my knowledge...
>> if it is because you program in windows, eclipse has an encoding setting
>> for the editors where you can switch encodings (in newer versions the
>> default encoding has been moved into the file associations).
>>
>> It is better to stick with utf8 throghout every possible layer that has
>> been my experience so far, which means, webpage utf8, resource files
>> utf8 database utf8, many other charsetzs have browser incompatibilities
>> or are not supported properly entirely.
>> (For instance if you go with ISO charsets you run into euro problems on
>> ie, or general encoding problems on ie forms)
>>
>>
>>
>> PeshoChuka schrieb:
>>>   Sory if this is not the right place for this posting but i really don't
>>> have an idea and i suspect everything at this moment.
>>> Hi, i am trying to start a simple JSF application that display cyrillic.
>>> The application is exactly one <h:outputtext>. I am using eclipse and i
>>> needed to change the encoding to Windows-1251.
>>>
>>> <%@page language="java" pageEncoding="WINDOWS-1251"
>>> contentType="text/html;
>>> charset=WINDOWS-1251" %>
>>> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
>>> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
>>> <f:loadBundle basename="resources.application" var="bundle"/>
>>> <f:view>
>>> <html>
>>> <head> 
>>> <h:outputText value="#{bundle['welcome.title']}" />
>>> </head>
>>> <body>
>>> <h:outputText value="#{bundle['welcome.heading']}" />
>>> <h:outputText value="#{bundle['welcome.message']}" />
>>> </body>
>>> </html>
>>> </f:view>
>>>
>>> In the browser the cyrrilic is broken. I set the browser encoding to
>>> CP1251.
>>> I tryed the same example with UTF8.
>>> I use JBOSS 4.0.5
>>>
>>> Thanks for the help. I really try to search the forum for the same
>>> problem
>>> but i couldnt find a solution.
>>>
>>>
>>
>>
> 


Re: [Solved] MyFaces cyrillic

Posted by Paul Iov <pa...@voller-ernst.de>.
Werner Punz schrieb:
> Paul Iov schrieb:
>   
>> Hi All,
>>
>> It's definitively the Eclipse (probably win32 only) issue! I've had the
>> same problem (but unfortunately no exact solution). If one switches the
>> encoding of EXISTING file, let's say, from 1251 to UTF8,  some
>> characters becomes converted in very strange way. I.e. German umlaut
>> becomes expanded into 4 monkey characters and stay in this state after
>> switching back. This should affect the resource files as well.
>>
>>     
> That is expected eclipse behavior, eclipse tries to retain the data as
> valid as possible,
> which means if you code a file in iso for instance and then switch to
> utf, it keeps the byte values but displays the utf data.
>
> you can try it out, code something with special chars switch the
> encoding and switch it back, at the back switch the data will be ok again.
>
> everything you type anew is in the new encoding however.
>
>
>   
Well, the 'conventional' special characters were not exactly the problem 
of mine. I've switched the encoding for my project and discovered one 
day later some mysterious runtime errors, something like "unexpected 
bytes in prolog". It took a lot of time to find this bytes, which was 
really present but just 'invisible' in other editor/encoding, and the 
only hint were that comments in German with 'disappeared' umlauts. It 
was really like a nightmare, since the encoding was switched for project 
with some hundreds of files but just two or three XML files was affected :)

Re: [Solved] MyFaces cyrillic

Posted by Werner Punz <we...@gmail.com>.
Paul Iov schrieb:
> Hi All,
> 
> It's definitively the Eclipse (probably win32 only) issue! I've had the
> same problem (but unfortunately no exact solution). If one switches the
> encoding of EXISTING file, let's say, from 1251 to UTF8,  some
> characters becomes converted in very strange way. I.e. German umlaut
> becomes expanded into 4 monkey characters and stay in this state after
> switching back. This should affect the resource files as well.
> 
That is expected eclipse behavior, eclipse tries to retain the data as
valid as possible,
which means if you code a file in iso for instance and then switch to
utf, it keeps the byte values but displays the utf data.

you can try it out, code something with special chars switch the
encoding and switch it back, at the back switch the data will be ok again.

everything you type anew is in the new encoding however.


Re: [Solved] MyFaces cyrillic

Posted by Paul Iov <pa...@voller-ernst.de>.
Hi All,

It's definitively the Eclipse (probably win32 only) issue! I've had the 
same problem (but unfortunately no exact solution). If one switches the 
encoding of EXISTING file, let's say, from 1251 to UTF8,  some 
characters becomes converted in very strange way. I.e. German umlaut 
becomes expanded into 4 monkey characters and stay in this state after 
switching back. This should affect the resource files as well.

Regards,
paul

Werner Punz schrieb:
> PeshoChuka schrieb:
>   
>>    Hi, I just want to say thanks for the help I solve it. You gave me the
>> direction to think.
>> I used native2ascii.exe convertor and it worked. But i still don't see why
>> without it it do not work as i have set through
>> eclipse utf-8.
>>
>> Anyway its ok now. Best regards.   
>>
>>     
> It is probably the old encoding, in the file still active, even if you
> switch the encoding to utf8 for new files, i do not know how eclipse
> behaves with old files, you should be save encodingwise in a new file
> you start but probably not in an old one loaded. In older eclipse
> versions there was a change encoding on the fly function, I do not know
> where it has moved to.
>
> Anyway I am glad it works now. Encoding can become hell once you have to
> move out of the utf8 domain.
>
>
>
>   


Re: [Solved] MyFaces cyrillic

Posted by Werner Punz <we...@gmail.com>.
PeshoChuka schrieb:
>    Hi, I just want to say thanks for the help I solve it. You gave me the
> direction to think.
> I used native2ascii.exe convertor and it worked. But i still don't see why
> without it it do not work as i have set through
> eclipse utf-8.
> 
> Anyway its ok now. Best regards.   
> 
It is probably the old encoding, in the file still active, even if you
switch the encoding to utf8 for new files, i do not know how eclipse
behaves with old files, you should be save encodingwise in a new file
you start but probably not in an old one loaded. In older eclipse
versions there was a change encoding on the fly function, I do not know
where it has moved to.

Anyway I am glad it works now. Encoding can become hell once you have to
move out of the utf8 domain.



Re: [Solved] MyFaces cyrillic

Posted by PeshoChuka <ma...@abv.bg>.
   Hi, I just want to say thanks for the help I solve it. You gave me the
direction to think.
I used native2ascii.exe convertor and it worked. But i still don't see why
without it it do not work as i have set through
eclipse utf-8.

Anyway its ok now. Best regards.   

-- 
View this message in context: http://www.nabble.com/MyFaces-cyrillic-tf3360867.html#a9352171
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [Solved] MyFaces cyrillic

Posted by PeshoChuka <ma...@abv.bg>.
 Hi,
I am using myfaces 1.1.3 that ships with Bea workshop studio. I will try now
to change to version 1.1.5 and i will post back results.
Thank you for your time.


Werner Punz-2 wrote:
> 
> Ok something is going wrong there,
> could be a bug, which myfaces version are you on?
> I will give it a try tonight in 1.1.5 normally this should
> work as expected if the resource file also is in utf-8
> 
> 
> 
> PeshoChuka schrieb:
>>   Ok I think i localized the problem, but i don't know how to fix it.
>> 
>> <%@page language="java" pageEncoding="UTF-8" contentType="text/html;
>> charset=utf8" %>
>> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
>> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
>> <f:loadBundle basename="resources.application" var="bundle"/>
>> <f:view>
>> <html>
>> <head>
>> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 
>> <title><h:outputText value="#{bundle['welcome.title']}" /></title>
>> </head>
>> <body>
>> <H1>поздрави!</H1>
>> <h3><h:outputText value="#{bundle['welcome.heading']}" /></h3>
>> <p><h:outputText value="#{bundle['welcome.message']}" /></p>
>> </body>
>> </html>
>> </f:view>
>> 
>>   I you see the cyrillic text in the <H1>..</H1>  it displays correctly
>> on
>> the web page.
>> But the text that is taken from the property files comes like monkeys.
>> The
>> property file is UTF-8 there is no doubgth.
>> I double checked it. So for some reasone the <h:outputtext> or the
>> resourcebundle is causing problems.
>> Do you have any idea?
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/MyFaces-cyrillic-tf3360867.html#a9350521
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [Solved] MyFaces cyrillic

Posted by Werner Punz <we...@gmail.com>.
Ok something is going wrong there,
could be a bug, which myfaces version are you on?
I will give it a try tonight in 1.1.5 normally this should
work as expected if the resource file also is in utf-8



PeshoChuka schrieb:
>   Ok I think i localized the problem, but i don't know how to fix it.
> 
> <%@page language="java" pageEncoding="UTF-8" contentType="text/html;
> charset=utf8" %>
> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
> <f:loadBundle basename="resources.application" var="bundle"/>
> <f:view>
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 
> <title><h:outputText value="#{bundle['welcome.title']}" /></title>
> </head>
> <body>
> <H1>поздрави!</H1>
> <h3><h:outputText value="#{bundle['welcome.heading']}" /></h3>
> <p><h:outputText value="#{bundle['welcome.message']}" /></p>
> </body>
> </html>
> </f:view>
> 
>   I you see the cyrillic text in the <H1>..</H1>  it displays correctly on
> the web page.
> But the text that is taken from the property files comes like monkeys. The
> property file is UTF-8 there is no doubgth.
> I double checked it. So for some reasone the <h:outputtext> or the
> resourcebundle is causing problems.
> Do you have any idea?


Re: [Solved] MyFaces cyrillic

Posted by PeshoChuka <ma...@abv.bg>.
  Ok I think i localized the problem, but i don't know how to fix it.

<%@page language="java" pageEncoding="UTF-8" contentType="text/html;
charset=utf8" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<f:loadBundle basename="resources.application" var="bundle"/>
<f:view>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 
<title><h:outputText value="#{bundle['welcome.title']}" /></title>
</head>
<body>
<H1>поздрави!</H1>
<h3><h:outputText value="#{bundle['welcome.heading']}" /></h3>
<p><h:outputText value="#{bundle['welcome.message']}" /></p>
</body>
</html>
</f:view>

  I you see the cyrillic text in the <H1>..</H1>  it displays correctly on
the web page.
But the text that is taken from the property files comes like monkeys. The
property file is UTF-8 there is no doubgth.
I double checked it. So for some reasone the <h:outputtext> or the
resourcebundle is causing problems.
Do you have any idea?
-- 
View this message in context: http://www.nabble.com/MyFaces-cyrillic-tf3360867.html#a9350083
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [Solved] MyFaces cyrillic

Posted by PeshoChuka <ma...@abv.bg>.
   My browser setting is UTF-8. It is correct, this is not the case. I just
started the application on appache tomcat
results are the same, looks like JBoss is also not the case. This becomes
more and more mistery to me:(


Werner Punz-2 wrote:
> 
> Check which encoding the browser displays...
> if you are not on utf-8 something interferes in your encoding settings
> delivered...
> 
> 
> 
> PeshoChuka schrieb:
>>    Thanks for the answere. I used the eclipse to change the encoding of
>> propertyfiles
>> to UTF-8. And also the encoding of JSP files to UTF-8 unfortunatly there
>> is
>> no change in
>> the status. Still only monkeys display. Is it possible the JBoss to
>> interfere somehow?
>> Thanks!
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/MyFaces-cyrillic-tf3360867.html#a9349992
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [Solved] MyFaces cyrillic

Posted by Werner Punz <we...@gmail.com>.
Check which encoding the browser displays...
if you are not on utf-8 something interferes in your encoding settings
delivered...



PeshoChuka schrieb:
>    Thanks for the answere. I used the eclipse to change the encoding of
> propertyfiles
> to UTF-8. And also the encoding of JSP files to UTF-8 unfortunatly there is
> no change in
> the status. Still only monkeys display. Is it possible the JBoss to
> interfere somehow?
> Thanks!


Re: [Solved] MyFaces cyrillic

Posted by PeshoChuka <ma...@abv.bg>.
   Thanks for the answere. I used the eclipse to change the encoding of
propertyfiles
to UTF-8. And also the encoding of JSP files to UTF-8 unfortunatly there is
no change in
the status. Still only monkeys display. Is it possible the JBoss to
interfere somehow?
Thanks!


Werner Punz-2 wrote:
> 
> Ok I indeed assume you have an encoding problem, the webpage probably
> has a different encoding than your resource file,
> but why wincp 1251, utf8 can handle cyrillc to my knowledge...
> if it is because you program in windows, eclipse has an encoding setting
> for the editors where you can switch encodings (in newer versions the
> default encoding has been moved into the file associations).
> 
> It is better to stick with utf8 throghout every possible layer that has
> been my experience so far, which means, webpage utf8, resource files
> utf8 database utf8, many other charsetzs have browser incompatibilities
> or are not supported properly entirely.
> (For instance if you go with ISO charsets you run into euro problems on
> ie, or general encoding problems on ie forms)
> 
> 
> 
> PeshoChuka schrieb:
>>   Sory if this is not the right place for this posting but i really don't
>> have an idea and i suspect everything at this moment.
>> Hi, i am trying to start a simple JSF application that display cyrillic.
>> The application is exactly one <h:outputtext>. I am using eclipse and i
>> needed to change the encoding to Windows-1251.
>> 
>> <%@page language="java" pageEncoding="WINDOWS-1251"
>> contentType="text/html;
>> charset=WINDOWS-1251" %>
>> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
>> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
>> <f:loadBundle basename="resources.application" var="bundle"/>
>> <f:view>
>> <html>
>> <head> 
>> <h:outputText value="#{bundle['welcome.title']}" />
>> </head>
>> <body>
>> <h:outputText value="#{bundle['welcome.heading']}" />
>> <h:outputText value="#{bundle['welcome.message']}" />
>> </body>
>> </html>
>> </f:view>
>> 
>> In the browser the cyrrilic is broken. I set the browser encoding to
>> CP1251.
>> I tryed the same example with UTF8.
>> I use JBOSS 4.0.5
>> 
>> Thanks for the help. I really try to search the forum for the same
>> problem
>> but i couldnt find a solution.
>> 
>> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/MyFaces-cyrillic-tf3360867.html#a9349809
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: MyFaces cyrillic

Posted by Werner Punz <we...@gmail.com>.
Ok I indeed assume you have an encoding problem, the webpage probably
has a different encoding than your resource file,
but why wincp 1251, utf8 can handle cyrillc to my knowledge...
if it is because you program in windows, eclipse has an encoding setting
for the editors where you can switch encodings (in newer versions the
default encoding has been moved into the file associations).

It is better to stick with utf8 throghout every possible layer that has
been my experience so far, which means, webpage utf8, resource files
utf8 database utf8, many other charsetzs have browser incompatibilities
or are not supported properly entirely.
(For instance if you go with ISO charsets you run into euro problems on
ie, or general encoding problems on ie forms)



PeshoChuka schrieb:
>   Sory if this is not the right place for this posting but i really don't
> have an idea and i suspect everything at this moment.
> Hi, i am trying to start a simple JSF application that display cyrillic.
> The application is exactly one <h:outputtext>. I am using eclipse and i
> needed to change the encoding to Windows-1251.
> 
> <%@page language="java" pageEncoding="WINDOWS-1251" contentType="text/html;
> charset=WINDOWS-1251" %>
> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
> <f:loadBundle basename="resources.application" var="bundle"/>
> <f:view>
> <html>
> <head> 
> <h:outputText value="#{bundle['welcome.title']}" />
> </head>
> <body>
> <h:outputText value="#{bundle['welcome.heading']}" />
> <h:outputText value="#{bundle['welcome.message']}" />
> </body>
> </html>
> </f:view>
> 
> In the browser the cyrrilic is broken. I set the browser encoding to CP1251.
> I tryed the same example with UTF8.
> I use JBOSS 4.0.5
> 
> Thanks for the help. I really try to search the forum for the same problem
> but i couldnt find a solution.
> 
>