-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Closed
Labels
Description
I posted this to go-nuts before realizing that this is probably a better place for this.
I apologize for the duplication.
Using code.google.com/p/go.net/html to parse and then re-render a chunk of HTML I
believe results in improper escaping of single quotes within double quotes. Here is a
simple test program that parses and re-renders a bit of HTML:
package main
import (
"bytes"
"fmt"
"log"
"strings"
"testing"
"code.google.com/p/go.net/html"
)
func main() {
data := `<div style="width:450px; font-family: 'Georgia', 'Times', 'Times New Roman', 'serif';" contenteditable="false">`
doc, err := html.Parse(strings.NewReader(data))
if err != nil {
log.Printf("html.Parse returned %s", err)
return
}
var b bytes.Buffer
err = Render(&b, doc)
if err != nil {
log.Printf("html.Render returned %s", err)
return
}
fmt.Printf("%s\n", b.String())
}
The single quotes are improperly escaped in the re-rendered code.
I believe the original HTML is valid. I've attached a small patch that fixes the
problem.
Thanks,
Mark
Attachments:
- render.patch (500 bytes)