Repository: go-playground/validator
Pull request #1081 (2023-03-19 23:25:41)

add kosovo
## Fixes Or Enhances
https://github.com/go-playground/validator/issues/1068
solves the kosovo missing from the iso_code. Kosovo doesn't have yet an official iso code but bank already use the added one.


**Make sure that you've checked the boxes below before you submit PR:**
- [ ] Tests exist or have been written that cover this particular change.

@go-playground/validator-maintainers

coveralls: 
[![Coverage Status](https://coveralls.io/builds/58006905/badge)](https://coveralls.io/builds/58006905)

Coverage: 73.862%. Remained the same when pulling **9c2458a73a331a477e93f2294c406f2bfc8b8f45 on Fonseca2570:issue-1068** into **f6f934c4e9238275d58780d0bc4a61c51c1bacb1 on go-playground:master**.


Patch:
diff --git a/country_codes.go b/country_codes.go
index 0d9eda0..b6c7a90 100644
--- a/country_codes.go
+++ b/country_codes.go
@@ -51,7 +51,7 @@ var iso3166_1_alpha2 = map[string]bool{
 	"TV": true, "UG": true, "UA": true, "AE": true, "GB": true,
 	"US": true, "UM": true, "UY": true, "UZ": true, "VU": true,
 	"VE": true, "VN": true, "VG": true, "VI": true, "WF": true,
-	"EH": true, "YE": true, "ZM": true, "ZW": true,
+	"EH": true, "YE": true, "ZM": true, "ZW": true, "XK": true,
 }
 
 var iso3166_1_alpha3 = map[string]bool{
@@ -105,7 +105,7 @@ var iso3166_1_alpha3 = map[string]bool{
 	"UGA": true, "UKR": true, "ARE": true, "GBR": true, "UMI": true,
 	"USA": true, "URY": true, "UZB": true, "VUT": true, "VEN": true,
 	"VNM": true, "VGB": true, "VIR": true, "WLF": true, "ESH": true,
-	"YEM": true, "ZMB": true, "ZWE": true, "ALA": true,
+	"YEM": true, "ZMB": true, "ZWE": true, "ALA": true, "UNK": true,
 }
 var iso3166_1_alpha_numeric = map[int]bool{
 	// see: https://www.iso.org/iso-3166-country-codes.html
@@ -158,7 +158,7 @@ var iso3166_1_alpha_numeric = map[int]bool{
 	800: true, 804: true, 784: true, 826: true, 581: true,
 	840: true, 858: true, 860: true, 548: true, 862: true,
 	704: true, 92: true, 850: true, 876: true, 732: true,
-	887: true, 894: true, 716: true, 248: true,
+	887: true, 894: true, 716: true, 248: true, 153:true,
 }
 
 var iso3166_2 = map[string]bool{
diff --git a/non-standard/validators/notblank.go b/non-standard/validators/notblank.go
index 80c815f..2867243 100644
--- a/non-standard/validators/notblank.go
+++ b/non-standard/validators/notblank.go
@@ -14,7 +14,7 @@ func NotBlank(fl validator.FieldLevel) bool {
 
 	switch field.Kind() {
 	case reflect.String:
-		return len(strings.TrimSpace(field.String())) > 0
+		return len(strings.Trim(strings.TrimSpace(field.String()), "\x1c\x1d\x1e\x1f")) > 0
 	case reflect.Chan, reflect.Map, reflect.Slice, reflect.Array:
 		return field.Len() > 0
 	case reflect.Ptr, reflect.Interface, reflect.Func:


Test patch:
diff --git a/non-standard/validators/notblank_test.go b/non-standard/validators/notblank_test.go
index 78c8781..96c6720 100644
--- a/non-standard/validators/notblank_test.go
+++ b/non-standard/validators/notblank_test.go
@@ -3,8 +3,8 @@ package validators
 import (
 	"testing"
 
-	"github.com/go-playground/validator/v10"
 	"github.com/go-playground/assert/v2"
+	"github.com/go-playground/validator/v10"
 )
 
 type test struct {
@@ -24,7 +24,7 @@ func TestNotBlank(t *testing.T) {
 	// Errors
 	var x *int
 	invalid := test{
-		String:    " ",
+		String:    " \x1c\x1d\x1e\x1f\r\n",
 		Array:     []int{},
 		Pointer:   x,
 		Number:    0,