Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruby 1.9.2 incompatible encoding regexp match #10

Open
winding-lines opened this issue May 21, 2010 · 7 comments
Open

ruby 1.9.2 incompatible encoding regexp match #10

winding-lines opened this issue May 21, 2010 · 7 comments

Comments

@winding-lines
Copy link

I am getting some encoding problems in REXML. Any idea on how to force the encodings to either UTF-8 or ASCII-8Bit?

Marius
[email protected]

REXML::ParseException
#<Encoding::CompatibilityError: incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string)>
/Users/myself/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rexml/source.rb:212:in match' /Users/myself/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rexml/source.rb:212:inmatch'
/Users/myself/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rexml/parsers/baseparser.rb:369:in pull' /Users/myself/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rexml/parsers/sax2parser.rb:92:inparse'
/Users/myself/.rvm/gems/ruby-1.9.2-head/bundler/gems/xmpp4r-58529d875336b42d7dd5afe6bf577599f9305014-master/lib/xmpp4r/streamparser.rb:79:in parse' /Users/myself/.rvm/gems/ruby-1.9.2-head/bundler/gems/xmpp4r-58529d875336b42d7dd5afe6bf577599f9305014-master/lib/xmpp4r/stream.rb:75:inblock in start'
...
Exception parsing
Line:
Position: 0
Last 80 unconsumed characters:
<presence from='[email protected]/Shawn’s MacBook Pro' to='[email protected]/
/Users/myself/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rexml/parsers/baseparser.rb:441:in rescue in pull' /Users/myself/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rexml/parsers/baseparser.rb:332:in pull'
/Users/myself/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rexml/parsers/sax2parser.rb:92:in parse' /Users/myself/.rvm/gems/ruby-1.9.2-head/bundler/gems/xmpp4r-58529d875336b42d7dd5afe6bf577599f9305014-master/lib/xmpp4r/streamparser.rb:79:in parse'
/Users/myself/.rvm/gems/ruby-1.9.2-head/bundler/gems/xmpp4r-58529d875336b42d7dd5afe6bf577599f9305014-master/lib/xmpp4r/stream.rb:75:in `block in start'

@bobanj
Copy link

bobanj commented Oct 1, 2010

add

encoding: utf-8

at the beginning of the file

@becatlibra-zz
Copy link

add that to the beginning of what file? I am having an identical issue:

W, [2010-11-06T11:50:27.783913 #29449] WARN -- : EXCEPTION: REXML::ParseException # /usr/local/lib/ruby/1.9.1/rexml/source.rb:212:in `match' /usr/local/lib/ruby/1.9.1/rexml/source.rb:212:in`match' /usr/local/lib/ruby/1.9.1/rexml/parsers/baseparser.rb:425:in `pull' /usr/local/lib/ruby/1.9.1/rexml/parsers/sax2parser.rb:92:in`parse' /usr/local/lib/ruby/gems/1.9.1/gems/xmpp4r-0.5/lib/xmpp4r/streamparser.rb:79:in `parse' /usr/local/lib/ruby/gems/1.9.1/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:75:in`block in start' ... Exception parsing Line: Position: 0 Last 80 unconsumed characters:

@bobanj
Copy link

bobanj commented Nov 7, 2010

At the beginning of the file where the error occurred add: #encoding: utf-8

@becatlibra-zz
Copy link

it is occurring after the code connects to the server. it is when the xmpp4r stream parser is parsing the incoming stanzas. Are you saying that I should be adding this to the streamparser.rb (part of the core of the xmpp4r module?)

@bobanj
Copy link

bobanj commented Nov 7, 2010

in every file that contains no ascii chars like for example шѓќч....so add it in the beginning of all files where there are non ascii chars...start with source.rb , baseparser.rb...it does no harm ...thats how 1.9 rolls ;) good luck

@becatlibra-zz
Copy link

The problem is that the characters that it cannot parse are coming in from the xmpp stream. They are not in a local file. The are in the incoming stanzas when the code connects to the xmpp server.

@dotdoom
Copy link

dotdoom commented Jan 12, 2011

see https://github.com/ln/xmpp4r/issues#issue/3 for possible solution. Please report if it helps. Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants