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
+3.3k Golang : Converting individual Jawi alphabet to Rumi(Romanized) alphabet example
+9.1k Golang : Convert file content to Hex
+14.6k Golang : How to reverse elements order in map ?
+18.2k Golang : Example for DSA(Digital Signature Algorithm) package functions
+9k CodeIgniter : Load different view for mobile devices
+12.8k Golang : Simple word wrap or line breaking example
+7.2k Golang : Routes multiplexer routing example with regular expression control
+19.3k Golang : Convert date string to variants of time.Time type examples
+12.7k Golang : How to pass map to html template and access the map's elements
+5.5k Unix/Linux : Use netstat to find out IP addresses served by your website server
+12.9k Golang : syscall.Socket example
+15k Golang : Execute terminal command to remote machine example