On Wed, 28 Mar 2018 20:05:34 -0700 (PDT)
[email protected] wrote:
> Is there any programmatic way to detect the messed up character? Possibly
> this is not the exact issue, because my file compiles on mac but not linux.
on linux you may use iconv tool:
$ iconv -f UTF8 file.go 2>&1 | tail -1
It will exit on the offending character with 'illegal input sequence at
position' message. Usually somewhere in the middle, so watch the
message line for 'iconv' string.
Eg:
badutf := []rune("abciconv: illegal input sequence at position
badutf := []rune("abc^-here
P.S. If you need line numbers you may annotate input with grep:
$ grep -n file.go | iconv -f utf7 2>&1 | tail -1
Hope this helps,
--
Wojciech S. Czarnecki
<< ^oo^ >> OHIR-RIPE
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.