You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Roman \"Blade\" Velichko" <bl...@ivc.tagmet.ru> on 2003/05/30 08:49:16 UTC

Re[2]: Non-latin charset in JavaScript messages

Hi to All!

DP> Can anybody help?

DP>> Page rendered in utf-8, but embeded javascript does not.
DP>> So non-latin literals in javascript leads to errors.
DP>> How can I fix it?

Try this

import org.apache.tapestry.*;
import org.apache.tapestry.html.*;

import java.io.*;

/**
 * <p><strong>Title:</strong> WebCards</p>
 * <p><strong>Description:</strong> Base class for all pages in
 * application</p>
 * <p><strong>Copyright:</strong> Copyright (c) 2003</p>
 * <p><strong>Company:</strong> OASU-ASUP TAGMET</p>
 * @author <a href="mailto:blade@ivc.tagmet.ru">Roman "Blade" Velichko</a>
 */
public class Win1251Pages extends BasePage
{
        /** Use concrete code page for youee pages
         *  @param out
         */
        public IMarkupWriter getResponseWriter(OutputStream out)
        {
                return new HTMLWriter("text/html; charset=windows-1251", out);
        }
}

than

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE page-specification PUBLIC
        "-//Howard Lewis Ship//Tapestry Specification 1.3//EN"
        "http://tapestry.sf.net/dtd/Tapestry_1_3.dtd">

<page-specification class="Win1251Pages">
        <component id="test" type="Insert">
                <binding name="value" expression="visit.testLogin"/>
        </component>
        <component id="homePage" type="PageLink">
                <static-binding name="page">Home</static-binding>
        </component>
</page-specification>


========
With best wishes
Roman "Blade" Velichko [mailto:blade@ivc.tagmet.ru]


Re[4]: Non-latin charset in JavaScript messages

Posted by "Roman \"Blade\" Velichko" <bl...@ivc.tagmet.ru>.
Hi to All!

DP> Nice hack! :)
DP> It works for me, but I think this is not appropriate approach for
DP> i18n applications and Tapestry developers should something change in
DP> javascript rendering.

May be it's a hack :-) but in own organization we have to use only
one language. Another trick for your subject is try to use
page-localization see documentations & vlib exam application...

========
With best wishes
Roman "Blade" Velichko [mailto:blade@ivc.tagmet.ru]


Re[3]: Non-latin charset in JavaScript messages

Posted by Denis Ponomarev <oz...@romsat.ua>.
Nice hack! :)
It works for me, but I think this is not appropriate approach for
i18n applications and Tapestry developers should something change in
javascript rendering.

Thank You!

DP>> Can anybody help?

DP>>> Page rendered in utf-8, but embeded javascript does not.
DP>>> So non-latin literals in javascript leads to errors.
DP>>> How can I fix it?

RBV> Try this

RBV> public class Win1251Pages extends BasePage
RBV> {
RBV>         public IMarkupWriter getResponseWriter(OutputStream out)
RBV>         {
RBV>                 return new HTMLWriter("text/html; charset=windows-1251", out);
RBV>         }
RBV> }