AppleScript名:文字列のURLエンコード、URLデコード |
— Created 2017-09-19 by Takaaki Naganoya — 2017 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" set aStr to "あいうえお" set bStr to encodeURLencoding(aStr) of me –> "%E3%81%82%E3%81%84%E3%81%86%E3%81%88%E3%81%8A" set cStr to decodeURLencoding(bStr) of me –> "あいうえお" on encodeURLencoding(origStr as string) set aStr to current application’s NSString’s stringWithString:origStr set encodedStr to aStr’s stringByAddingPercentEscapesUsingEncoding:(current application’s NSUTF8StringEncoding) return encodedStr as string end encodeURLencoding on decodeURLencoding(encodedStr) set aStr to current application’s NSString’s stringWithString:encodedStr set bStr to aStr’s stringByReplacingPercentEscapesUsingEncoding:(current application’s NSUTF8StringEncoding) return bStr as string end decodeURLencoding |
More from my site
(Visited 254 times, 1 visits today)