[twitter-dev] Re: Does “~” need encode?

2011-06-19 Thread LoVenus
Thank you very much. It's useful.

On Jun 18, 2:09 am, Felix Oldenburg oldenburg.fe...@googlemail.com
wrote:
 I had the same issue with the ~ encoding. If ~ gets encoded to %7E the
 signature is wrong, but with a plain ~ it's fine.

 But if u look at abraham's php twitter library, which also implements
 the needed oauth functionality, u can see he also uses the non encoded
 ~.
 (https://github.com/abraham/twitteroauth)

 This is his url encoding method:
 (See OAuth.h in the OAuthUtil class)

 public static function urlencode_rfc3986($input) {
   if (is_array($input)) {
     return array_map(array('OAuthUtil', 'urlencode_rfc3986'), $input);
   } else if (is_scalar($input)) {
     return str_replace(
       '+',
       ' ',
       str_replace('%7E', '~', rawurlencode($input))
     );
   } else {
     return '';
   }

 As one can see, the %7E gets decoded back to ~.
 Maybe RFC3986 is worth a look.

 On 17 Jun., 12:36, kamesh SmartDude kamesh.smartd...@gmail.com
 wrote:







  There might be some other problem in u r signature generation.

  but not about the ~ url encoding.

  //kamesh

  On Fri, Jun 17, 2011 at 1:57 PM, LoVenus pzunderta...@hotmail.com wrote:
   Thank you for your reply.

   But as I said, ifencode~, signature will be wrong.

   --
   Twitter developer documentation and resources:https://dev.twitter.com/doc
   API updates via Twitter:https://twitter.com/twitterapi
   Issues/Enhancements Tracker:
  https://code.google.com/p/twitter-api/issues/list
   Change your membership to this group:
  https://groups.google.com/forum/#!forum/twitter-development-talk

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


[twitter-dev] Re: Does “~” need encode?

2011-06-19 Thread LoVenus
Thank you!

On Jun 18, 2:18 am, Abraham Williams 4bra...@gmail.com wrote:
 Characters in the unreserved character set as defined by RFC3986 (ALPHA,
 DIGIT, -, ., _, ~) MUST NOT be encoded.

 http://tools.ietf.org/html/rfc5849#section-3.6

 Abraham
 -
 Abraham Williams | InboxQ http://inboxq.com/ | abrah.am
 @abraham https://twitter.com/intent/follow?screen_name=abraham |
 github.com/abraham | blog.abrah.am
 This email is: [ ] shareable [x] ask first [ ] private.

 On Fri, Jun 17, 2011 at 11:09, Felix Oldenburg 







 oldenburg.fe...@googlemail.com wrote:
  I had the same issue with the ~ encoding. If ~ gets encoded to %7E the
  signature is wrong, but with a plain ~ it's fine.

  But if u look at abraham's php twitter library, which also implements
  the needed oauth functionality, u can see he also uses the non encoded
  ~.
  (https://github.com/abraham/twitteroauth)

  This is his url encoding method:
  (See OAuth.h in the OAuthUtil class)

  public static function urlencode_rfc3986($input) {
   if (is_array($input)) {
     return array_map(array('OAuthUtil', 'urlencode_rfc3986'), $input);
   } else if (is_scalar($input)) {
     return str_replace(
       '+',
       ' ',
       str_replace('%7E', '~', rawurlencode($input))
     );
   } else {
     return '';
   }

  As one can see, the %7E gets decoded back to ~.
  Maybe RFC3986 is worth a look.

  On 17 Jun., 12:36, kamesh SmartDude kamesh.smartd...@gmail.com
  wrote:
   There might be some other problem in u r signature generation.

   but not about the ~ url encoding.

   //kamesh

   On Fri, Jun 17, 2011 at 1:57 PM, LoVenus pzunderta...@hotmail.com
  wrote:
Thank you for your reply.

But as I said, if encode ~, signature will be wrong.

--
Twitter developer documentation and resources:
 https://dev.twitter.com/doc
API updates via Twitter:https://twitter.com/twitterapi
Issues/Enhancements Tracker:
   https://code.google.com/p/twitter-api/issues/list
Change your membership to this group:
   https://groups.google.com/forum/#!forum/twitter-development-talk

  --
  Twitter developer documentation and resources:https://dev.twitter.com/doc
  API updates via Twitter:https://twitter.com/twitterapi
  Issues/Enhancements Tracker:
 https://code.google.com/p/twitter-api/issues/list
  Change your membership to this group:
 https://groups.google.com/forum/#!forum/twitter-development-talk

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


[twitter-dev] Re: Does “~” need encode?

2011-06-17 Thread LoVenus
Thank you for your reply.

But as I said, if encode ~, signature will be wrong.

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


Re: [twitter-dev] Re: Does “~” need encode?

2011-06-17 Thread kamesh SmartDude
There might be some other problem in u r signature generation.

but not about the ~ url encoding.

//kamesh

On Fri, Jun 17, 2011 at 1:57 PM, LoVenus pzunderta...@hotmail.com wrote:

 Thank you for your reply.

 But as I said, if encode ~, signature will be wrong.

 --
 Twitter developer documentation and resources: https://dev.twitter.com/doc
 API updates via Twitter: https://twitter.com/twitterapi
 Issues/Enhancements Tracker:
 https://code.google.com/p/twitter-api/issues/list
 Change your membership to this group:
 https://groups.google.com/forum/#!forum/twitter-development-talk


-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


[twitter-dev] Re: Does “~” need encode?

2011-06-17 Thread Felix Oldenburg
I had the same issue with the ~ encoding. If ~ gets encoded to %7E the
signature is wrong, but with a plain ~ it's fine.

But if u look at abraham's php twitter library, which also implements
the needed oauth functionality, u can see he also uses the non encoded
~.
( https://github.com/abraham/twitteroauth )

This is his url encoding method:
(See OAuth.h in the OAuthUtil class)

public static function urlencode_rfc3986($input) {
  if (is_array($input)) {
return array_map(array('OAuthUtil', 'urlencode_rfc3986'), $input);
  } else if (is_scalar($input)) {
return str_replace(
  '+',
  ' ',
  str_replace('%7E', '~', rawurlencode($input))
);
  } else {
return '';
  }

As one can see, the %7E gets decoded back to ~.
Maybe RFC3986 is worth a look.

On 17 Jun., 12:36, kamesh SmartDude kamesh.smartd...@gmail.com
wrote:
 There might be some other problem in u r signature generation.

 but not about the ~ url encoding.

 //kamesh







 On Fri, Jun 17, 2011 at 1:57 PM, LoVenus pzunderta...@hotmail.com wrote:
  Thank you for your reply.

  But as I said, if encode ~, signature will be wrong.

  --
  Twitter developer documentation and resources:https://dev.twitter.com/doc
  API updates via Twitter:https://twitter.com/twitterapi
  Issues/Enhancements Tracker:
 https://code.google.com/p/twitter-api/issues/list
  Change your membership to this group:
 https://groups.google.com/forum/#!forum/twitter-development-talk

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk