Skip to content

Conversation

moorereason
Copy link
Contributor

The root cause of issue #8079 was a non-breaking space (U+0160).
unicode.IsPrint only allows the ASCII space (U+0020). Be more lenient
by using unicode.IsGraphic instead.

Fixes #8079

@bep
Copy link
Member

bep commented Mar 13, 2021

Can you fix the commit message?

The root cause of issue gohugoio#8079 was a non-breaking space (U+0160).
`unicode.IsPrint` only allows the ASCII space (U+0020).  Be more lenient
by using `unicode.IsGraphic` instead.

Fixes gohugoio#8079
@moorereason moorereason changed the title exif: allow more spacing characters in strings exif: Allow more spacing characters in strings Mar 13, 2021
@moorereason
Copy link
Contributor Author

Fixed.

@@ -227,7 +227,7 @@ func (e *exifWalker) Walk(f _exif.FieldName, tag *tiff.Tag) error {
func nullString(in []byte) string {
var rv bytes.Buffer
for _, b := range in {
if unicode.IsPrint(rune(b)) {
if unicode.IsGraphic(rune(b)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, taking a second look at this, there is one more error in this, as this will not handle multi-byte runes. See the loop in this example:

https://golang.org/pkg/unicode/utf8/#DecodeRune

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit pushed. Fixing this should remove the need for the utf8.ValidString check. PTAL

@bep bep merged commit f6612d8 into gohugoio:master Mar 13, 2021
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Image descriptions in EXIF data with non ASCII characters is missing
2 participants