Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > SOAP4R throws exception on copyright character

Thread Tools

SOAP4R throws exception on copyright character

Brian Marick
Posts: n/a
Lots of web pages contain copyright characters (not © but
something that displays in Mozilla view source as the copyright symbol,
in emacs as a square box, and probably says to the world "Hi! I'm an
HTML file that was created with Word."). SOAP4r is unhappy with that
character, as you can see in this use of the googleSearch sample:

% ruby wsdlDriver.rb 'Mark Swanson'
/usr/local/lib/ruby/1.8/xsd/datatypes.rb:184:in `_set':
{}string: cannot accept 'Artwork by
<b>Mark</b> <b>Swanson</b> Copyright 2002 <b>Mark</b>
<b>Swanson</b>. All rights reserved. '. (XSD::ValueSpaceError)
from /usr/local/lib/ruby/1.8/xsd/datatypes.rb:125:in `set'
from /usr/local/lib/ruby/1.8/soap/encodingstyle/soapHandler.rb:446:in
from /usr/local/lib/ruby/1.8/soap/encodingstyle/soapHandler.rb:223:in

In contrast, the Java version that comes with the Google API download
prints the peculiar character.

This is easy for me to work around, just comment out the check in

def _set(value)
unless XSD::Charset.is_ces(value, XSD::Charset.encoding)
raise"#{ type }: cannot accept '#{ value
@data = value

My questions:
1) Is there a better workaround?
Or something I'm misunderstanding?
2) Is this behavior something that
should be changed in SOAP4r?
3) Is Google in error in delivering
that character in that type of string?

I am using ruby 1.8.1-preview2 and the code from soap4r-1_5_1.

Brian Marick
Consulting, training, contracting, and research
Focused on the intersection of testing, programming, and design Removed), (E-Mail Removed),

Reply With Quote
Posts: n/a
Hi, good morning from far east.

> From: "Brian Marick" <(E-Mail Removed)>
> Sent: Sunday, November 09, 2003 5:57 AM

> % ruby wsdlDriver.rb 'Mark Swanson'
> /usr/local/lib/ruby/1.8/xsd/datatypes.rb:184:in `_set':
> {}string: cannot accept 'Artwork by
> <b>Mark</b> <b>Swanson</b> Copyright 2002 <b>Mark</b>
> <b>Swanson</b>. All rights reserved. '. (XSD::ValueSpaceError)
> from /usr/local/lib/ruby/1.8/xsd/datatypes.rb:125:in `set'
> from /usr/local/lib/ruby/1.8/soap/encodingstyle/soapHandler.rb:446:in
> `decode_textbuf'
> from /usr/local/lib/ruby/1.8/soap/encodingstyle/soapHandler.rb:223:in
> `decode_tag_end'

GoogleAPI returns "\xc2\xa9" sequence in utf-8 format. Can you try this?
$ ruby -Ku wsdlDriver.rb 'Mark Swanson Copyright Artwork'

There may be another reason (no iconv?) though... I cannot reproduce
the same error on my linux/cygwin boxes even though I run the
wsdlDriver.rb with "-Kn".

Beside this, I should add '$KCODE = "UTF8"' at the head of the

// NaHi

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Character encoding & the copyright symbol Robert Dailey Python 11 08-06-2009 08:26 PM
Is an exception specification needed if the method throws and catchesits own exception? C++ 2 11-27-2007 04:01 AM
Youtube copyright infringements are not all bad for the copyright holders? Colin B Digital Photography 195 01-19-2007 09:00 AM
Exception Exception is not compatible with throws clause in Chris Miller Java 4 11-22-2003 03:11 PM
XmlValidatingReader throws exception for SAOP-ENV:encodingStyle attribute Himmat Dhange ASP .Net 0 08-26-2003 08:28 PM