Argh. I even thought of that but setting it *after* the request had been
accessed (by Lift internals) appears to have no effect. I suppose there's
some caching going on there. Any possibility we could add a control to
LiftRules? Something like:

var totallyBrokenDefaultPostCharsetHandling = false

Where a false value means we automatically set the request charset to UTF-8
and a true value means that we don't touch the request. My expectation given
that we're already 9 years into the new millenium (yeah, yeah, only 8) is
that *everything* on the net would be UTF-8 unless explicitly forced to be
something else.

Derek

On Sun, Mar 15, 2009 at 8:34 PM, David Pollak <feeder.of.the.be...@gmail.com
> wrote:

>
>
> On Mon, Mar 16, 2009 at 2:07 AM, Charles F. Munat <c...@munat.com> wrote:
>
>>
>> That's got it. I added it to the FAQ on the wiki.
>>
>> Thanks, David! Wish I'd been smart enough to ask this a week ago!
>
>
> I bloodies my head with that one for a good couple of weeks.  Glad it's
> working.
>
>
>>
>>
>> Chas.
>>
>> David Pollak wrote:
>> > Folks,
>> >
>> > Please make sure you've got this method in your Boot.scala class:
>> >
>> >   /**
>> >    * Force the request to be UTF-8
>> >    */
>> >   private def makeUtf8(req: HttpServletRequest) {
>> >     req.setCharacterEncoding("UTF-8")
>> >   }
>> >
>> > And also in the boot method, put:
>> >     LiftRules.early.append(makeUtf8)
>> >
>> > By default, various app servers (Tomcat is the worst) does not use
>> > UTF-8... I mean WTF... the web is UTF unless otherwise specified.
>> >
>> > Anyway... please give that a try and let me know if it works.
>> >
>> > Thanks,
>> >
>> > David
>> >
>> >
>> > On Sun, Mar 15, 2009 at 1:26 PM, Derek Chen-Becker
>> > <dchenbec...@gmail.com <mailto:dchenbec...@gmail.com>> wrote:
>> >
>> >     OK, I can replicate this in our PocketChange app (also going against
>> >     a PostgreSQL DB). Let me dig a bit.
>> >
>> >     Derek
>> >
>> >
>> >     On Sun, Mar 15, 2009 at 3:58 AM, Charles F. Munat <c...@munat.com
>> >     <mailto:c...@munat.com>> wrote:
>> >
>> >
>> >         This might help, but I don't think I was clear. I have an online
>> >         form.
>> >         My clients enter text into it. Their text has characters like a
>> >         c with a
>> >         cedilla. That text gets saved into a PostgreSQL database (UTF-8)
>> >         varchar
>> >         field via JPA/Hibernate.
>> >
>> >         Then I pull it back out and dump it into a template, and it
>> >         comes out
>> >         gibberish. If I try using &ccedil; instead, I get &amp;cedil;
>> >         back out.
>> >
>> >         Here is what I have:
>> >
>> >         "name" -> SHtml.text(thing.name <http://thing.name>, thing.name
>> >         <http://thing.name> = _, ("size", "40"))
>> >
>> >         If I enter "cachaça" in the field, I get cachaça back out. The
>> >         weird
>> >         thing is that sometimes when I copy and paste text from another
>> >         document
>> >         into the form, it works. But if I use the keyboard, it fails
>> >         every time.
>> >
>> >         I'll play around with this. Thanks.
>> >
>> >         Chas.
>> >
>> >         Derek Chen-Becker wrote:
>> >          > Oops, forgot scala.xml.Unparsed, too:
>> >          >
>> >          > scala> val m = <span>a{ scala.xml.Unparsed("&ccedil;")
>> }b</span>
>> >          > m: scala.xml.Elem = <span>a&ccedil;b</span>
>> >          >
>> >          > That one might be what you're looking for.
>> >          >
>> >          > Derek
>> >          >
>> >          > On Sat, Mar 14, 2009 at 9:57 PM, Derek Chen-Becker
>> >          > <dchenbec...@gmail.com <mailto:dchenbec...@gmail.com>
>> >         <mailto:dchenbec...@gmail.com <mailto:dchenbec...@gmail.com>>>
>> >         wrote:
>> >          >
>> >          >     I think it depends on how you're embedding them in the
>> XML:
>> >          >
>> >          >     scala> val m = <span>a&ccedil;b</span>
>> >          >     m: scala.xml.Elem = <span>a&ccedil;b</span>
>> >          >
>> >          >     scala> val m = <span>a{"&ccedil;"}b</span>
>> >          >     m: scala.xml.Elem = <span>a&amp;ccedil;b</span>
>> >          >
>> >          >     scala> val m = <span>a{"ç"}b</span>
>> >          >     m: scala.xml.Elem = <span>açb</span>
>> >          >
>> >          >     That last one was input using dead keys (alt+,) on my
>> >         linux (USA
>> >          >     International with dead keys) layout. Let me know if this
>> >         doesn't
>> >          >     help; if not, could you send the code/template that's
>> >         having issues?
>> >          >
>> >          >     Derek
>> >          >
>> >          >
>> >          >     On Sat, Mar 14, 2009 at 6:36 PM, Charles F. Munat
>> >         <c...@munat.com <mailto:c...@munat.com>
>> >          >     <mailto:c...@munat.com <mailto:c...@munat.com>>> wrote:
>> >          >
>> >          >
>> >          >         I have a site that uses a lot of "special" characters
>> >         (a remarkably
>> >          >         biased description, since there is nothing "special"
>> >         about accented
>> >          >         characters to the people who use them daily). In
>> >         particular, I
>> >          >         need the
>> >          >         c with cedilla and the n with the tilde.
>> >          >
>> >          >         These characters are being input to a database
>> >         (UTF-8) via an online
>> >          >         form, then spit back out onto the page.
>> >          >
>> >          >         It's a fucking disaster. Apparently, everything goes
>> >         through the xml
>> >          >         parser, which is great, except when I try to enter
>> >         these as entity
>> >          >         references, such as &ccedil;, the parser changes & to
>> >         &amp; and
>> >          >         I get
>> >          >         the literal &ccedil; back out again.
>> >          >
>> >          >         When I type ç using the keyboard (or copy and paste
>> >         it from a
>> >          >         page or a
>> >          >         text editor), I get gibberish.
>> >          >
>> >          >         Anyone know the trick to getting around this? I need
>> >         everything
>> >          >         from e
>> >          >         acute to e grave to trademark and registered
>> >         trademark symbols,
>> >          >         and I
>> >          >         need to enter them this way.
>> >          >
>> >          >         Thanks for any help. If I can get this to work, I'll
>> >         add an
>> >          >         explanation
>> >          >         to the wiki.
>> >          >
>> >          >         Chas.
>> >          >
>> >          >
>> >          >
>> >          >
>> >          >
>> >          > >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > --
>> > Lift, the simply functional web framework http://liftweb.net
>> > Beginning Scala http://www.apress.com/book/view/1430219890
>> > Follow me: http://twitter.com/dpp
>> > Git some: http://github.com/dpp
>> >
>> > >
>>
>>
>>
>
>
> --
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> 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 liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to