Code Monkey home page Code Monkey logo

Comments (4)

hanklords avatar hanklords commented on August 17, 2024

Hello kinumi,

I believe this is an encoding bug. Can you try the commit 2133762 I just pushed and tell me if it works ?

Thanks,
Mael

from flickraw.

kinumi avatar kinumi commented on August 17, 2024

Thanks,

I tried it, then...
ruby1.9.3 -> ok
ruby1.8.7 -> ng (and I want to use 1.8.7!)

Test Code:
("現像" is "\xE7\x8F\xBE\xE5\x83\x8F" in utf8)

#!ruby -Ku

require "rubygems"
require "uri"
require "./flickraw/lib/flickraw"

str = "現像"
puts "#{str} should be escaped to [#{URI.escape(str)}]"
puts "#{str} is escaped to [#{FlickRaw::OAuthClient.escape(str)}]"

Result:

$ rvm use 1.9.3
$ ruby -I ./flickraw/lib/ flickr.rb
現像 should be escaped to [%E7%8F%BE%E5%83%8F]
現像 is escaped to [%E7%8F%BE%E5%83%8F]
$ rvm use 1.8.7
$ ruby -I ./flickraw/lib/ flickr.rb
現像 should be escaped to [%E7%8F%BE%E5%83%8F]
現像 is escaped to [%E7%E5]

from flickraw.

kinumi avatar kinumi commented on August 17, 2024

I modified oauth.rb. It seems to work well.

Before:

      def escape(s)
        encode_value(s).gsub(/[^a-zA-Z0-9\-\.\_\~]/) {
          sprintf("%%%02X", $&.unpack("C")[0])
        }
      end

After:

      def escape(s)
        encode_value(s).gsub(/[^a-zA-Z0-9\-\.\_\~]/) {
          $&.unpack("C*").map{|i| sprintf("%%%02X", i) }.join
        }
      end

from flickraw.

hanklords avatar hanklords commented on August 17, 2024

I have commited it on b33601c.

Thank you for the bug report and the patch !

from flickraw.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.