lordexilon / google-refine

Automatically exported from code.google.com/p/google-refine
Other
0 stars 0 forks source link

escape(value, encoding) returns "null" for non-string values #548

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm using XML encoding on the values as I'm saving to RDF.

"escape(value,'xml')" works fine when there are characters to escape, but if 
the value is safe, the function returns "null".

Attached screenshot.

Original issue reported on code.google.com by danpaulsmith on 12 Mar 2012 at 4:38

Attachments:

GoogleCodeExporter commented 9 years ago
Is XML the only encoding affected?  Looking at your sample values, I'm a little 
suspicious that all the failing ones are numbers.  Does the same thing happen 
with strings which don't need encoding?

Original comment by tfmorris on 13 Mar 2012 at 3:05

GoogleCodeExporter commented 9 years ago
All encodings are affected. You're right about the failing ones being numbers.

The escape() function appears to return "null" for numbers and dates that have 
been typed within Refine. Attached another screenshot with the column in view.

Original comment by danpaulsmith on 13 Mar 2012 at 3:20

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed in r2463.  As a workaround, you can use value.toString().escape("xml") 
instead of value.escape("xml")

Original comment by tfmorris on 14 Mar 2012 at 3:09

GoogleCodeExporter commented 9 years ago

Original comment by tfmorris on 14 Mar 2012 at 3:21

GoogleCodeExporter commented 9 years ago
Hi, 

I've updated to r2482 and escape('xml', value) is still returning "null" for 
integers.

Do I need to convert the value to a string first, or did you mean you've fixed 
it so it handles dates and integers?

Thanks,
Dan

Original comment by danpaulsmith on 20 Mar 2012 at 11:48

GoogleCodeExporter commented 9 years ago
I changed it so that any non-string gets run through ToString() first.  If 
you're running from Eclipse, you may need to run the Ant build first ./refine 
build since I've sometimes old classfiles picked up otherwise.

If you're definitely running the latest code and it's still not working, please 
provide some example data and I'll check to see if there's a corner case I 
missed.

Original comment by tfmorris on 20 Mar 2012 at 7:28

GoogleCodeExporter commented 9 years ago
Hi Tom,

All good, thanks. Used "ant build" and "./refine".

Cheers!

Original comment by danpaulsmith on 21 Mar 2012 at 9:56

GoogleCodeExporter commented 9 years ago

Original comment by tfmorris on 18 Sep 2012 at 3:05