You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailscale/drive/driveimpl/shared/xml.go

17 lines
324 B
Go

// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
package shared
import (
"bytes"
"encoding/xml"
)
// EscapeForXML escapes the given string for use in XML text.
func EscapeForXML(s string) string {
result := bytes.NewBuffer(nil)
xml.Escape(result, []byte(s))
return result.String()
}