From b22c7929aa9cd788135d467bf3779d1a166f43b6 Mon Sep 17 00:00:00 2001 From: kmoe <5575356+kmoe@users.noreply.github.com> Date: Wed, 30 Aug 2023 16:59:27 +0100 Subject: [PATCH] Use Unicode 15 tables cty relies on two external libraries that have Unicode tables embedded in them: golang.org/x/text contains the unicode normalization tables and github.com/apparentlymart/go-textseg contains the unicode grapheme cluster segmentation tables. This updates both of those dependencies to include the Unicode 15 tables instead of the Unicode 13 tables as before. This is intended to align with Go 1.21's own support for Unicode 15; applications which care about consistent unicode support should upgrade to Go 1.21 at the same time as updating to a new version of cty with these changes. --- CHANGELOG.md | 6 +++++- cty/ctystrings/prefix.go | 2 +- cty/function/stdlib/format.go | 2 +- cty/function/stdlib/string.go | 2 +- go.mod | 4 ++-- go.sum | 8 ++++---- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b329859a..b7230ca4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ -# 1.13.4 (Unreleased) +# 1.14.0 (Unreleased) +This release updates the supported version of Unicode from Unicode 13 to Unicode 15. This is a backwards-compatible change that means that cty supports normalization and segmentation of strings containing new Unicode characters. The algorithms for normalization and segmentation themselves are unchanged. + +* `cty`: The `cty.String` type will now normalize incoming string values using the Unicode 15 normalization rules. +* `function/stdlib`: The various string functions which split strings into individual characters as part of their work will now use the Unicode 15 version of the text segmentation algorithm to do so. # 1.13.3 (August 24, 2023) diff --git a/cty/ctystrings/prefix.go b/cty/ctystrings/prefix.go index ac62e18f..bbf04523 100644 --- a/cty/ctystrings/prefix.go +++ b/cty/ctystrings/prefix.go @@ -4,7 +4,7 @@ import ( "fmt" "unicode/utf8" - "github.com/apparentlymart/go-textseg/v13/textseg" + "github.com/apparentlymart/go-textseg/v15/textseg" "golang.org/x/text/unicode/norm" ) diff --git a/cty/function/stdlib/format.go b/cty/function/stdlib/format.go index d04a5eec..2339cc33 100644 --- a/cty/function/stdlib/format.go +++ b/cty/function/stdlib/format.go @@ -6,7 +6,7 @@ import ( "math/big" "strings" - "github.com/apparentlymart/go-textseg/v13/textseg" + "github.com/apparentlymart/go-textseg/v15/textseg" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/convert" diff --git a/cty/function/stdlib/string.go b/cty/function/stdlib/string.go index 57ebce1b..f79bf98d 100644 --- a/cty/function/stdlib/string.go +++ b/cty/function/stdlib/string.go @@ -6,7 +6,7 @@ import ( "sort" "strings" - "github.com/apparentlymart/go-textseg/v13/textseg" + "github.com/apparentlymart/go-textseg/v15/textseg" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/function" diff --git a/go.mod b/go.mod index f07ab8cf..a9b678e7 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,10 @@ module github.com/zclconf/go-cty require ( - github.com/apparentlymart/go-textseg/v13 v13.0.0 + github.com/apparentlymart/go-textseg/v15 v15.0.0 github.com/google/go-cmp v0.3.1 github.com/vmihailenco/msgpack/v5 v5.3.5 - golang.org/x/text v0.3.8 + golang.org/x/text v0.11.0 ) require ( diff --git a/go.sum b/go.sum index cb4f7b02..a2a7960f 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= -github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= +github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= +github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -14,8 +14,8 @@ github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9 github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= -golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= +golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=