sketchucation logo sketchucation
    • Login
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Embedded Quotes in Ruby Strings

    scheduled pinned locked moved Developers' Forum
    3 Posts 2 Posters 278 Views 2 Watching
    loading-more-posts
    • oldest-to-newest
    • newest-to-oldest
    • most-votes
    reply
    • reply-as-topic
    guest-login-reply
    deleted-message
    • M Offline
      MartinRinehart
      last edited by

      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.

      Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

      one-reply-to-this-post last-reply-time reply quote 0
      • Al HartA Offline
        Al Hart
        last edited by

        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

        http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
        IRender nXt from Render Plus

        one-reply-to-this-post last-reply-time reply quote 0
        • M Offline
          MartinRinehart
          last edited by

          @al hart said:

          We wound up using base64 encoding.

          Great minds... Ruby had issues until I switched from chars 32-95 to 48-111.

          Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

          one-reply-to-this-post last-reply-time reply quote 0
          • 1 / 1
          • first-post
            last-post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement