P
Perry Smith
Title pretty much says it all. Here is a small sample program:
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
s = "string"
puts s.encoding
r = Regexp.new(s)
puts r.encoding
Here is the output:
UTF-8
US-ASCII
I was expecting both to be set to UTF-8. There is no force_encoding
method for RegExp.
If I later try to use it on strings of type UTF-8, it can throw an
exception.
How is this suppose to be handled?
Thanks,
Perry
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
s = "string"
puts s.encoding
r = Regexp.new(s)
puts r.encoding
Here is the output:
UTF-8
US-ASCII
I was expecting both to be set to UTF-8. There is no force_encoding
method for RegExp.
If I later try to use it on strings of type UTF-8, it can throw an
exception.
How is this suppose to be handled?
Thanks,
Perry