# a patch for compatibility with ruby 2.0
#
# fixed upstream in version 2013.10.20 07:09
# http://www.ntg.nl/pipermail/ntg-context/2013/075016.html
# http://tug.org/svn/texlive?view=revision&revision=32605
#
--- runfiles/texmf-dist/scripts/context/ruby/base/switch.rb.orig
+++ runfiles/texmf-dist/scripts/context/ruby/base/switch.rb
@@ -1,3 +1,5 @@
+#encoding: ASCII-8BIT
+
 # module    : base/switch
 # copyright : PRAGMA Advanced Document Engineering
 # version   : 2002-2005
@@ -488,7 +490,7 @@ class CommandLine
     def dirtyvalue(value)
         if value then
             value.gsub(/([\"\'])(.*?)\1/) do
-                $2.gsub(/\s+/o, "\xFF")
+                $2.gsub(/\s+/o, "\0xFF")
             end
         else
             ''
@@ -498,7 +500,7 @@ class CommandLine
     def cleanvalue(value)
         if value then
             # value.sub(/^([\"\'])(.*?)\1$/) { $2.gsub(/\xFF/o, ' ') }
-            value.gsub(/\xFF/o, ' ')
+            value.gsub(/\0xFF/o, ' ')
         else
             ''
         end
@@ -567,7 +569,7 @@ class CommandLine
 
     def locateseries(series, value)
 
-        series.each do |key|
+        series.each_char do |key|
             locatesingle(key,cleanvalue(value))
         end