Skip to content

Commit 979f4e3

Browse files
committed
Replace all .getBytes() by .getBytes("UTF-8") to avoid encoding errors through copy-pasting
1 parent e996791 commit 979f4e3

File tree

4 files changed

+799
-800
lines changed

4 files changed

+799
-800
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ That's it! You have generated an instance of `com.github.plokhotnyuk.jsoniter_sc
104104
Now you can use it for parsing and serialization:
105105

106106
```scala
107-
val user = readFromArray("""{"name":"John","devices":[{"id":1,model:"HTC One X"}]}""".getBytes)
107+
val user = readFromArray("""{"name":"John","devices":[{"id":1,model:"HTC One X"}]}""".getBytes("UTF-8"))
108108
val json = writeToArray(User(name = "John", devices = Seq(Device(id = 2, model = "iPhone X"))))
109109
```
110110

core/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/core/JsonWriter.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,8 +1261,8 @@ object JsonWriter {
12611261
(0 to 99).map(i => (((i / 10 + '0') << 8) + (i % 10 + '0')).toShort)(breakOut)
12621262
private final val hexDigits: Array[Byte] =
12631263
Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f')
1264-
private final val minIntBytes: Array[Byte] = "-2147483648".getBytes
1265-
private final val minLongBytes: Array[Byte] = "-9223372036854775808".getBytes
1264+
private final val minIntBytes: Array[Byte] = "-2147483648".getBytes("UTF-8")
1265+
private final val minLongBytes: Array[Byte] = "-9223372036854775808".getBytes("UTF-8")
12661266
private final val maxZonedDateTimeLength: Int = {
12671267
val mostLongZoneId = ZoneId.of(ZoneId.getAvailableZoneIds.asScala.maxBy(_.length))
12681268
ZonedDateTime.ofLocal(LocalDateTime.MAX, mostLongZoneId, ZoneOffset.UTC).toString.length + 5

0 commit comments

Comments
 (0)