Skip to content

v1.29.0: opt-in Unicode chars mode

Latest
Compare
Choose a tag to compare
@benhoyt benhoyt released this 18 Sep 20:56

This release adds Unicode chars mode with goawk -c (or by setting Config.Chars to true when using the Go API). The default is bytes mode as it was before (except that printf %c used chars mode by default as of v1.28.0 -- now it only does if chars mode is enabled). Note that this is the same default as mawk, but the opposite of Gawk (which uses gawk -b to switch to bytes mode).

Chars mode applies to index(), length(), match() (including RSTART and RLENGTH), substr(), and printf's %c verb.

For example, as of version v1.29.0, you can do this:

$ goawk 'BEGIN { print length("a"), length("絵") }'
1 3
$ goawk -c 'BEGIN { print length("a"), length("絵") }'
1 1

Full Changelog: v1.28.1...v1.29.0