I'm using Eclipse IDE or Notepad++. The last issue "Error in
processing html page" was because Eclipse defaults to cp1252 encoding
on Windows for saving files. I went Window->Preferences->General-
>Workspace menu and changed the default to UTF-8 to save the html
files in the correct format and the problem disappeared.
About this issue, if I don't set the encoding of the
HttpServletRequest explicitly in the code with setCharacterEncoding,
it looks like that Java picks up the default platform settings which
happens to be something else than UTF-8 on my Windows machine. I don't
know how to change that... maybe some Swedish person has a suggestion
for this?
Now thinking about this a second time, I checked the HTTP headers of
the POST request with Firefox "Live HTTP headers" plugin and UTF-8 is
specified in the line:
Content-Type: text/html; charset=UTF-8
Given this information is present, shouldn't the encoding of the
HttpServletRequest be set automatically?
Thanks,
Sebastien
On Nov 13, 11:23 am, Tim Perrett <[EMAIL PROTECTED]> wrote:
> Out of interest, what text editor are you using? There are other guys
> using windows on this list and I'm pretty sure they have no problems.
>
> I've seen some problems with VS on windows, but there are plenty of x-
> platform editors which will work just fine - I rently did a small lift
> app in sweedish and had no problems :-)
>
> Cheers, Tim
>
> Sent from my iPhone
>
> On 13 Nov 2008, at 06:08, "Sebastien Bocq" <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > Yes, it works. I didn't found any way to change the default encoding
> > to UTF-8 on Windows, all I found is that it is possible to set the
> > encoding Java uses via the command line by specifying
> > -Dfile.encoding=UTF8. I'll set it manually in the code like you
> > showed, it is the most practical approach.
>
> > Thanks!
> > Sebastien
>
> >> Try this... In Boot.scala, add the following line to the boot method:
>
> >> LiftRules.appendEarly(makeUtf8)
>
> >> And the following method to the Boot class:
> >> private def makeUtf8(req: HttpServletRequest): Unit =
> >> {req.setCharacterEncoding("UTF-8")}
>
> >> That will force the character encoding to be UTF-8 rather than
> >> whatever the
> >> platform coding is.
>
> >> On Wed, Nov 12, 2008 at 11:59 AM, Sebastien Bocq <[EMAIL PROTECTED]
>
> >> wrote:
>
> >>>> What browser are you using to test?
>
> >>> Firefox (UTF-8 turned on)
>
> >>>> What container is your app running in?
>
> >>> Jetty (started with mvn jetty:run)
>
> >>>> What OS is your app running on?
>
> >>> Windows XP (French)
>
> >>>> On Wed, Nov 12, 2008 at 8:13 AM, sbocq <[EMAIL PROTECTED]>
> >>>> wrote:
>
> >>>>> Hello,
>
> >>>>> I'm facing another UTF-8 encoding issue. When I submit text with
> >>>>> accented characters in a text field from the browser, the encoding
> >>>>> gets lost somewhere on its way to the RequestVar. I'm using the
> >>>>> code
> >>>>> snippet below that writes back the list of messages submitted. For
> >>>>> example, when I type "hé!" in the "Update" submit form, I ge
> >>>>> t back
> >>>>> "#é# hÃ(c)!" in the browser.
>
> >>>>> class Update {
> >>>>> object qpx extends RequestVar(Full("")) // default is empty string
>
> >>>>> def show(xhtml: NodeSeq): NodeSeq = {
> >>>>> val msgSent = !(qpx.isEmpty || qpx.open_!.length == 0)
> >>>>> if (msgSent){
> >>>>> val msg:Message = Message.create
> >>>>> msg.text(qpx.open_!).save
> >>>>> }
> >>>>> val messages = Message.findAll
> >>>>> val temp = messages.foldLeft(""){(str, msg) => str + " #é# " +
> >>>>> msg.text}
>
> >>>>> bind("qp", xhtml,
> >>>>> "update" --> text("", v => qpx(Full(v))) % ("size" ->
> >>>>> "10")
> >>>>> % ("id" -> "update"),
> >>>>> "submit" --> submit(?("Update"), ignore => {}),
> >>>>> "messages" --> <div>{temp}</div>
> >>>>> )
> >>>>> }
> >>>>> }
>
> >>>>> <lift:surround with="default" at="content">
> >>>>> <div class="heading" id="title">¿Qué pasa?</div>
> >>>>> <lift:Update.show form="POST">
> >>>>> <label for="update">What's going on? </label>
> >>>>> <qp:update/>
> >>>>> <qp:submit/>
> >>>>> <qp:messages/>
> >>>>> </lift:Update.show>
> >>>>> </lift:surround>
>
> >>>>> Thanks,
> >>>>> Sebastien
>
> >>>> --
> >>>> Lift, the simply functional web frameworkhttp://liftweb.net
> >>>> Collaborative Task Managementhttp://much4.us
> >>>> Follow me:http://twitter.com/dpp
> >>>> Git some:http://github.com/dpp
>
> >> --
> >> Lift, the simply functional web frameworkhttp://liftweb.net
> >> Collaborative Task Managementhttp://much4.us
> >> Follow me:http://twitter.com/dpp
> >> Git some:http://github.com/dpp
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---