Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

space and chinese issue fixed.

  • Loading branch information...
commit 2b468b134cfd19d8b2873a9e5577e0d1f0307d0d 1 parent 168eeb5
rex@Dell authored
Showing with 16 additions and 12 deletions.
  1. +13 −0 curlicue
  2. +3 −12 curlicue-setup
View
13 curlicue
@@ -52,6 +52,16 @@ url_encode() {
echo
}
+#special for utf-8 Chinese
+chinese_status()
+{
+ line="$*"
+ olds=`echo $line | grep -oP "(?<=status%3D).*$"`
+ news=`echo $olds |sed -e "s#%#%25#g" -e "s#%2526#%2520#g" -e "s#%252520#%2520#g" -e "s#%25252B#%2520#ig" 2>/dev/null`
+ result=`echo $line | sed -e "s#$olds#$news#" 2>/dev/null`
+ echo $result
+}
+
quote_vals() {
sed 's/=\(.*\)/="\1"/'
}
@@ -138,8 +148,11 @@ fi
# This is where the magic happens.
+#special for Spaces inside of status
+url_params=`echo "$url_params" |sed -e "s# #%20#g" -e"s#\+#%2b#g"`
params="$(mk_params "$url_params" | join_params '&')"
base_string="$method&$(url_encode "$url")&$(url_encode "$params")"
+base_string=`chinese_status $base_string`
signing_key="$oauth_consumer_secret&$oauth_token_secret"
oauth_signature="$(hmac_sha1 "$signing_key" "$base_string")"
sig_params="oauth_signature=$(url_encode "$oauth_signature")"
View
15 curlicue-setup
@@ -2,18 +2,8 @@
umask 077
-#if [ $# = 4 ]; then
-if [ $# = 1 ]; then
-# request_token_url="$1"
-# authorize_url="$2"
-# access_token_url="$3"
-# output_file="$4"
- output_file="$1"
-else
-# echo "usage: $0 REQ_TOKEN_URL AUTHORIZE_URL ACCESS_TOKEN_URL OUTPUT_FILE"
- echo "Usage: $0 OUTPUT_FILE"
- exit 2
-fi
+base="$HOME/.fftoken"
+mkdir -p $base
access_token_url='http://fanfou.com/oauth/access_token'
@@ -29,6 +19,7 @@ stty -echo
read -p "Fanfou Password: " password ; echo
stty echo
+output_file="$base/$name.token"
echo "oauth_consumer_key=$(curlicue -u "$key")&oauth_consumer_secret=$(
curlicue -u "$secret")" > $consumer_tmp

0 comments on commit 2b468b1

Please sign in to comment.
Something went wrong with that request. Please try again.