magiconair / properties

Java properties scanner for Go
BSD 2-Clause "Simplified" License
323 stars 77 forks source link

Equal sign is incorrectly escaped in key #59

Open nicolaferraro opened 3 years ago

nicolaferraro commented 3 years ago

I'm doing the following test:

// Set a key to "a=b" and value "c"
p := properties.NewProperties()
p.Set("a=b", "c")
buf := new(bytes.Buffer)
p.Write(buf, properties.UTF8)
println(buf.String())

I'd espect the serialized version to be:

a\=b = c

Since the \ should be used to escape the first equal sign, but the program prints:

a=b = c

Which seems wrong. If saved in a file and read again, the key becomes "a" (while, when reading from the correct file, the key is correctly interpreted as "a=b").