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
+6.2k Golang : How to validate ISBN?
+15.2k Golang : Get current time from the Internet time server(ntp) example
+12.1k Golang : Sort and reverse sort a slice of bytes
+9.6k Golang : Channels and buffered channels examples
+5.7k Golang : Build new URL for named or registered route with Gorilla webtoolkit example
+33.3k Golang : convert(cast) bytes to string
+7.6k Findstr command the Grep equivalent for Windows
+35.8k Golang : Convert date or time stamp from string to time.Time type
+18.5k Golang : Populate dropdown with html/template example
+16.8k Google Chrome : Your connection to website is encrypted with obsolete cryptography
+12.5k Golang : How to calculate the distance between two coordinates using Haversine formula
+19.4k Swift : Convert (cast) Int to int32 or Uint32