Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[merb-core] Assume UTF-8 query strings

As long as no Encoding.default_internal is specified, we assume incoming
query strings to be UTF-8. This should be valid as long as we create them.
  • Loading branch information...
commit f7feedcff203f2aee1a855118bc2e440a9696733 1 parent 6018fb8
@ngollan ngollan authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 merb-core/lib/merb-core/dispatch/request_parsers.rb
6 merb-core/lib/merb-core/dispatch/request_parsers.rb
@@ -221,6 +221,10 @@ def self.escape_xml(s)
# Converts a query string snippet to a hash and adds it to existing
# parameters.
+ # @note On encoding-aware Ruby VMs, this assumes that either
+ # `Encoding.default_internal` is set or that query parameters are
+ # UTF-8.
+ #
# @param [Hash] parms Parameters to add the normalized parameters to.
# @param [String] name The key of the parameter to normalize.
# @param [String] val The value of the parameter.
@@ -234,7 +238,7 @@ def self.normalize_params(parms, name, val=nil)
after = $' || ''
if val.respond_to?(:force_encoding)
- val.force_encoding(Encoding.default_internal)
+ val.force_encoding(Encoding.default_internal || 'utf-8')
if after == ""
Please sign in to comment.
Something went wrong with that request. Please try again.