• Russ Cox's avatar
    encoding/json: escape & always · 080e00d5
    Russ Cox authored
    There are a few different places in the code that escape
    possibly-problematic characters like < > and &.
    This one was the only one missing &, so add it.
    
    This means that if you Marshal a string, you get the
    same answer you do if you Marshal a string and
    pass it through the compactor. (Ironically, the
    compaction makes the string longer.)
    
    Because html/template invokes json.Marshal to
    prepare escaped strings for JavaScript, this changes
    the form of some of the escaped strings, but not
    their meaning.
    
    R=golang-dev, bradfitz
    CC=golang-dev
    https://golang.org/cl/12708044
    080e00d5
escape_test.go 40.2 KB