Standard library / strconv
strconv.QuoteToASCII()
Returns a double-quoted Go literal with non-ASCII characters escaped, preserving the original value when unquoted. Expected stdout: '"\\u00e9"\n'.
Formal Syntax & Structure
go syntaxgo
func QuoteToASCII(s string) stringParameters & Attributes
| Name | Type | Description |
|---|---|---|
| s | string | Input text to parse, inspect or quote. |
Return Value
string
Encoded representation.
Working Example
Example Snippetgo
package main
import ( "fmt" "strconv")
func main() { fmt.Println(strconv.QuoteToASCII("é"))}