Skip to content

Conversation

@clagenna
Copy link

Due to some HEIC file converters to JPG longitude and latitude strings gets converted from UNICODE with wrong UTF-8 coding. e.g. North "N" have hex bytes hex:4e ef bf bd For that reason latitudeRef.trim().equalsIgnoreCase("n") fails. My suggestion is to use substring(0, 1) instead of trim()

Thanks for your contribution to Apache Commons! Your help is appreciated!

Before you push a pull request, review this list:

  • Read the contribution guidelines for this project.
  • Run a successful build using the default Maven goal with mvn; that's mvn on the command line by itself.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible but is a best-practice.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body. Note that commits might be squashed by a maintainer on merge.

Due to some HEIC file converters to JPG longitude and latitude strings gets converted from UNICODE  with wrong UTF-8 coding. e.g. North "N" have hex bytes hex:4e ef bf bd
For that reason latitudeRef.trim().equalsIgnoreCase("n") fails. My suggestion  is to use substring(0, 1) instead of trim()
@garydgregory
Copy link
Member

This doesn't look right to me and will break existing applications that have leading or trailing whitespace in that data.

Are you saying that some other app is creating bad data?

@clagenna
Copy link
Author

clagenna commented May 14, 2025 via email

@garydgregory
Copy link
Member

Hello @clagenna
Let me understand:

  • you have a HEIC file
  • you use PaintShopPro to convert it to a JPG
  • you use Commons Imaging to read the JPG

Does the data start bad in the HEIC file?

Does PSP create a bad file?

Can you provide a unit test with each file that demonstrates the issue? Ideally the test should fail if the changes to 'main' aren't applied.

Ty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants