Embedded Quotes in Ruby Strings
-
Don't read this. It's here for Google search to rescue someone.
In the other languages I've used, from C through JavaScript, quotes were just characters within strings. The only issue was embedding them in string constants where you had to escape them.
Not so in Ruby. It just wreaked havoc with a string-encoded bitmap I was passing from JavaScript. Changing the encoding base from 32 to 48 (48.chr == bits 000000) omits the quotes and solves the problem.
Unencrypted source code for the bitmap-related classes is in the VisMap Ruby.
-
One problem with encoding a binary string into 32 bit integers is that Ruby does not allow 32-bit integers. (It turns anything with more than 31 bits into a 64-bit bignum) And SketchUp doesn't seem to process BIGNUM at all. We wound up using base64 encoding .
-
@al hart said:
We wound up using base64 encoding.
Great minds... Ruby had issues until I switched from chars 32-95 to 48-111.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginAdvertisement