Repository: kubernetes/klog (go)

Issue:
klogr flatten logs some strings oddly
/kind bug

**What steps did you take and what happened:**
Had a klogr log something with `>` in the string, and saw it come out as `u003e`

**What did you expect to happen:**
Just prints the `>` character


**Anything else you would like to add:**
https://play.golang.org/p/xoZ7_N1tkUw


Pull request description:
fix serialization of special html chars
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. If this is your first time, read our contributor guidelines https://git.k8s.io/community/contributors/guide/pull-requests.md#the-pull-request-submit-process and developer guide https://git.k8s.io/community/contributors/devel/development.md#development-guide
2. If you want *faster* PR reviews, read how: https://git.k8s.io/community/contributors/guide/pull-requests.md#best-practices-for-faster-reviews
3. Follow the instructions for writing a release note: https://git.k8s.io/community/contributors/guide/release-notes.md
4. If the PR is unfinished, see how to mark it: https://git.k8s.io/community/contributors/guide/pull-requests.md#marking-unfinished-pull-requests
5. If this PR changes image versions, please title this PR "Bump <image name> from x.x.x to y.y.y."
-->

**What this PR does / why we need it**:
json encoder treats some of the html chars differently, let's switch off the escape for the html special characters.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #139 

**Special notes for your reviewer**:

_Please confirm that if this PR changes any image versions, then that's the sole change this PR makes._

**Release note**:
<!--  Write your release note:
1. Enter your extended release note in the below block. If the PR requires additional action from users switching to the new release, include the string "action required".
2. If no release note is required, just write "NONE".
-->
```release-note
NONE
```

Patch:
diff --git a/klogr/klogr.go b/klogr/klogr.go
index 944cb70..9791cd8 100644
--- a/klogr/klogr.go
+++ b/klogr/klogr.go
@@ -8,6 +8,7 @@ import (
 	"fmt"
 	"runtime"
 	"sort"
+	"strings"
 
 	"github.com/go-logr/logr"
 	"k8s.io/klog/v2"
@@ -139,8 +140,11 @@ func pretty(value interface{}) string {
 			value = err.Error()
 		}
 	}
-	jb, _ := json.Marshal(value)
-	return string(jb)
+	buffer := &bytes.Buffer{}
+	encoder := json.NewEncoder(buffer)
+	encoder.SetEscapeHTML(false)
+	encoder.Encode(value)
+	return strings.TrimSpace(string(buffer.Bytes()))
 }
 
 func (l klogger) Info(msg string, kvList ...interface{}) {


Test patch:
diff --git a/klogr/klogr_test.go b/klogr/klogr_test.go
index 795eefd..712ac9c 100644
--- a/klogr/klogr_test.go
+++ b/klogr/klogr_test.go
@@ -66,6 +66,12 @@ func TestInfo(t *testing.T) {
 			text:          "test",
 			keysAndValues: []interface{}{"akey", "avalue", "akey2"},
 			expectedOutput: ` "msg"="test"  "akey"="avalue" "akey2"=null
+`,
+		},
+		"should correctly html characters": {
+			text:          "test",
+			keysAndValues: []interface{}{"akey", "<&>"},
+			expectedOutput: ` "msg"="test"  "akey"="<&>"
 `,
 		},
 		"should correctly handle odd-numbers of KVs in both log values and Info args": {