Golang : constant 20013 overflows byte error message
Haven't been updating the tutorials portion for a while as I was busy writing up examples for Golang bytes package. While executing the bytes.Buffer.WriteByte function example. The program exited with the error message "constant 20013 overflows byte error message".
Upon further investigation, it was caused by this line in the code
buff.WriteByte('中')
To fix this error which is attempting to write UTF8 character, simply replace WriteByte() with WriteRune() function.
buff.WriteRune('中')
Hope this will be helpful to whoever that encounter this error message.
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+5.1k Golang : Get missing location after unmarshal binary and gob decode time.
+9.5k Golang : Create matrix with Gonum Matrix package example
+20.4k Golang : Convert seconds to minutes and remainder seconds
+8.7k Golang : Bcrypting password
+13k Golang : ROT47 (Caesar cipher by 47 characters) example
+14.8k Golang : Get sub string example
+12k Golang : Get user input until a command or receive a word to stop
+17.7k Golang : Calculate entire request body length during run time
+10.8k Golang : Convert a rune to unicode style string \u
+3.2k Javascript : Empty an array example
+10.5k Golang : Convert decimal number(integer) to IPv4 address
+18.3k Golang : Close channel after ticker stopped example