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
+11.4k Golang : Handle API query by curl with Gorilla Queries example
+21k Golang : For loop continue,break and range
+23.8k Golang : Fix type interface{} has no field or no methods and type assertions example
+9.1k Golang : Gonum standard normal random numbers example
+5.1k Golang : Issue HTTP commands to server and port example
+14.3k Golang : Parsing or breaking down URL
+25.6k Golang : How to write CSV data to file
+13.9k Golang : Compress and decompress file with compress/flate example
+6.7k Golang : Output or print out JSON stream/encoded data
+6.3k Golang : Detect face in uploaded photo like GPlus
+10.2k Golang : How to check if a website is served via HTTPS
+9.5k Golang : Validate IPv6 example