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
+2.3k PHP : Fix Call to undefined function curl_init() error
+8.4k CodeIgniter : Import Linkedin data
+3.8k Golang : Convert source code to assembly language
+2.3k Golang : Display packages names during compilation
+5.8k Golang : Print UTF-8 fonts on image example
+2.7k Golang : Characters limiter example
+3k Android Studio : AlertDialog to get user attention example
+3.9k Fix ERROR 1045 (28000): Access denied for user 'root'@'ip-address' (using password: YES)
+13.1k Golang : Get ASCII code from a key press(cross-platform) example
+1.4k Golang : How to fix html/template : "somefile" is undefined error?
+8.1k Golang : Get URI segments by number and assign as variable example
+3.3k Golang : alternative to os.Exit() function