Skip to content

Instantly share code, notes, and snippets.

@mccoder
Created April 5, 2012 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mccoder/2313266 to your computer and use it in GitHub Desktop.
Save mccoder/2313266 to your computer and use it in GitHub Desktop.
#encoding: utf-8
=begin
Copyright 2010 Denis Kokorin <virkdi@mail.ru>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end
require 'rexml/encoding'
require 'rexml/source'
module REXML
# A Source can be searched for patterns, and wraps buffers and other
# objects and provides consumption of text
class IOSource
alias :match_old :match
def match( pattern, cons=false )
@buffer.force_encoding("utf-8")
match_old( pattern, cons )
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment