Comments (2)
Thank you @lostghost
from goamz.
It is also supposed to replace "+"
with "%2B"
, which the url.URL{}
trick doesn't seem to accomplish (which I noticed while debugging why I can't s3.Get()
objects that have a +
in the name)
http://play.golang.org/p/pOfrn-Wsq5
package main
import (
"fmt"
"net/url"
)
func main() {
// Standard QueryEscape call encodes a space with a "+" character.
// This is because the specs allow either a "+" or "%20" for encoding
// of a space character in URL Query strings and this function was
// written for that purpose.
myFirstString := "Hello world"
myFirstEncodedString := url.QueryEscape(myFirstString)
fmt.Println("URL QueryEscape:", myFirstEncodedString)
// However, the logic for encoding a space using "%20" is build into
// the net/url package, it is just not readily exposed. We can access
// it by encoding a url path, where a space must be encoded as "%20"
// according to spec.
mySecondString := "Hello world"
t := &url.URL{Path: mySecondString}
mySecondEncodedString := t.String()
fmt.Println("URL Path Encoded:", mySecondEncodedString)
// Unfortunately, we are also supposed to encode "+" as "%2B", which
// the url.URL{} trick doesn't do
myThirdString := "Hello+world"
t = &url.URL{Path: myThirdString}
myThirdEncodedString := t.String()
fmt.Println("URL Path Encoded:", myThirdEncodedString)
}
from goamz.
Related Issues (20)
- Using bucket qualified hostnames with S3
- Add support for AWS China EndPoint HOT 2
- Pin all outside repo packages HOT 1
- Use V4 signer in SNS
- S3: Allow parameters to be passed to GET requests
- TYPE_BOOL : Missing NewBoolAttribute HOT 4
- S3 Use tcpdump httprequest find something wrong HOT 6
- Support for S3 PreSigned POST HOT 1
- Use profiles when selecting credentials from ~/.aws/credentials HOT 1
- parameter names should be sorted in v4signer HOT 3
- DescribeInstanceStatus returns empty InstanceStatuses list. HOT 2
- dynamodb: can't update attributes with custom update expression
- Not found ExclusiveStartStreamName and Limit parameter of ListStreams method in https://github.com/AdRoll/goamz/blob/master/kinesis/kinesis.go HOT 1
- s3: how to track upload progress
- Support ap-northeast-2
- Need "if-unmodified-since" support to (*Bucket)Del()
- [S3] V4signature support HOT 2
- Please add support for missing regions HOT 1
- Int overflow on 32 bits arches
- Possible exposed AWS Key HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goamz.