Hi, I'm quite a newbie to Lift. I'm now trying to port my first Lift
application from Lift1.0.2 to latest Lift2.0-scala280, and faced a
problem relating to source encoding.
I managed to merge pom.xml and some codes on Boot.scala, and succeeded
to build my application, but when I access to it from browser, it
displays:
Message: java.nio.charset.UnmappableCharacterException: Input length =
2
java.nio.charset.CoderResult.throwException(CoderResult.java:261)
sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:319)
sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
java.io.InputStreamReader.read(InputStreamReader.java:167)
java.io.BufferedReader.fill(BufferedReader.java:136)
java.io.BufferedReader.read(BufferedReader.java:157)
scala.io.BufferedSource$$anonfun$1$$anonfun$apply$1.apply
(BufferedSource.scala:29)
scala.io.BufferedSource$$anonfun$1$$anonfun$apply$1.apply
(BufferedSource.scala:29)
scala.io.Codec.wrap(Codec.scala:65)
scala.io.BufferedSource$$anonfun$1.apply(BufferedSource.scala:29)
scala.io.BufferedSource$$anonfun$1.apply(BufferedSource.scala:29)
scala.collection.Iterator$$anon$13.next(Iterator.scala:145)
scala.collection.Iterator$$anon$24.hasNext(Iterator.scala:435)
scala.collection.Iterator$$anon$19.hasNext(Iterator.scala:326)
scala.io.Source.hasNext(Source.scala:209)
net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply
$4.apply(PCDataMarkupParser.scala:184)
... and more
I traced Lift source and found out that "Codec" argument is not
passed to Source.fromInputStream(in) at PCDataMarkupParser.scala(l.
182). "Codec" api seems to be introduced newly in Scala 2.8, and
Source.fromInputStream() uses Codec.default as a implicit argument.
My problem here, is I'm using utf-8 for write *.html templates, but
my Codec.default is "MS932"(Japanese characterset in Windows), so
failing to decode my template files. I looked through Scala lib
source, and found out Codec.default it is actually an alias to
java.lang.Charset.getDefault(), so I just set -Djava.encoding=utf-8 to
MVN_OPTS and solved the problem, but considering deployment, I don't
think it's a smart way.
BTW, I confirmed this does not occur on Lift2.0-scala2.7.7. I think
default source encoding should be somehow configurable in Lift to
achieve portability.
Kind regards,
Pomu TAKEUCHI
--
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.