Skip to content

Instantly share code, notes, and snippets.

@windymelt
Created October 30, 2013 09:41
Show Gist options
  • Save windymelt/7229756 to your computer and use it in GitHub Desktop.
Save windymelt/7229756 to your computer and use it in GitHub Desktop.
play 2.1.0のエンコーディングをShift-JISに変更するdiff
--- play-2.1.0.orig/play-2.1.0/framework/src/play/src/main/scala/play/api/mvc/ContentTypes.scala 2013-02-05 09:51:23.000000000 +0900
+++ play-2.1.0/framework/src/play/src/main/scala/play/api/mvc/ContentTypes.scala 2013-08-31 12:58:01.000000000 +0900
@@ -277,7 +277,7 @@
*/
def tolerantText(maxLength: Int): BodyParser[String] = BodyParser("text, maxLength=" + maxLength) { request =>
Traversable.takeUpTo[Array[Byte]](maxLength)
- .transform(Iteratee.consume[Array[Byte]]().map(c => new String(c, request.charset.getOrElse("utf-8"))))
+ .transform(Iteratee.consume[Array[Byte]]().map(c => new String(c, request.charset.getOrElse("Shift_JIS/*utf-8*/"))))
.flatMap(Iteratee.eofOrElse(Results.EntityTooLarge))
}
@@ -460,7 +460,7 @@
Traversable.takeUpTo[Array[Byte]](maxLength).apply(Iteratee.consume[Array[Byte]]().mapDone { c =>
scala.util.control.Exception.allCatch[Map[String, Seq[String]]].either {
- FormUrlEncodedParser.parse(new String(c, request.charset.getOrElse("utf-8")), request.charset.getOrElse("utf-8"))
+ FormUrlEncodedParser.parse(new String(c, request.charset.getOrElse("Shift_JIS")), request.charset.getOrElse("Shift_JIS"))
}.left.map { e =>
Play.maybeApplication.map(_.global.onBadRequest(request, "Error parsing application/x-www-form-urlencoded")).getOrElse(Results.BadRequest)
}
--- play-2.1.0.orig/play-2.1.0/play 2013-02-05 09:51:25.000000000 +0900
+++ play-2.1.0/play 2013-08-31 00:13:34.000000000 +0900
@@ -61,5 +61,5 @@
fi
else
- "$JAVA" -Dsbt.ivy.home=$dir/repository -Dplay.home=$dir/framework -Dsbt.boot.properties=$dir/framework/sbt/play.boot.properties -jar $dir/framework/sbt/sbt-launch.jar "$@"
+ "$JAVA" -Dfile.encoding=Shift-JIS -Dsbt.ivy.home=$dir/repository -Dplay.home=$dir/framework -Dsbt.boot.properties=$dir/framework/sbt/play.boot.properties -jar $dir/framework/sbt/sbt-launch.jar "$@"
fi
--- play-2.1.0.orig/play-2.1.0/play.bat 2013-02-05 09:51:25.000000000 +0900
+++ play-2.1.0/play.bat 2013-10-30 18:36:26.000000000 +0900
@@ -14,7 +14,7 @@
if exist "project" goto existingApplication
:noApplication
-java -Dsbt.ivy.home="%~dp0repository" -Dplay.home="%~dp0framework" -Dsbt.boot.properties="%fp%framework/sbt/play.boot.properties" -jar "%~dp0framework\sbt\sbt-launch.jar" %*
+java -Dfile.encoding=Shift-JIS -Dsbt.ivy.home="%~dp0repository" -Dplay.home="%~dp0framework" -Dsbt.boot.properties="%fp%framework/sbt/play.boot.properties" -jar "%~dp0framework\sbt\sbt-launch.jar" %*
goto end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment