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
+7.8k Golang : Capture text return from exec function example
+6k Golang : Mapping Iban to Dunging alphabets
+14.1k Golang : How do I get the local IP (non-loopback) address ?
+9.4k Golang : Select region of interest with mouse click and crop from image
+2.2k Golang : Switch Redis database redis.NewClient
+5k Golang : Function as an argument type example
+10.6k Linux : How to install driver for 600Mbps Dual Band Wifi USB Adapter
+8.7k Golang : Sort and reverse sort a slice of floats
+8.1k Golang : Timeout example
+16.1k Golang : Qt image viewer example
+9.1k Golang : Read file and convert content to string
+11.9k Golang : Handle or parse date string with Z suffix(RFC3339) example