Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Decoding skips values with Unicode characters #2000

@rgmz

Description

@rgmz

Describe the bug
The current decoder logic filters values that contain non-ascii characters. This works quite well, however, if the encoded value contains a unicode character (chinese symbols, ê, etc.) it will be silently skipped.

// isPrintableASCII returns true if all bytes are printable ASCII
func isPrintableASCII(b []byte) bool {
for _, c := range b {
if !printableASCII[c] {
return false
}
}
return true
}

To Reproduce

  1. Base64-encode a value that uses a valid UTF8 character
  2. Attempt to decode it; it will be skipped.

Expected behavior
Segments with valid UTF8 characters ideally shouldn't be skipped. I don't know what the performance implications are of this.

cc @zricethezav @bplaxco

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions