Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: Convert path from UTF-8 to UTF-16 before loading google-services.json #1383

Merged
merged 16 commits into from
Jul 13, 2023

Conversation

jonsimantov
Copy link
Contributor

@jonsimantov jonsimantov commented Jul 11, 2023

Description

Provide details of the change, and generalize the change in the PR title above.

On Desktop, when the Unity SDK sets the default google-services.json file path, it uses UTF-8 to encode the string. This PR modifies the JSON load method to properly convert the filename to UTF-16 before loading it on Windows, so that the file loads correctly from paths containing international characters.


Testing

Describe how you've tested these changes. Link any manually triggered Integration tests or CPP binary SDK Packaging Github Action workflows, if applicable.

Unit test added to ensure that the json file can be loaded from international paths.

Unity SDK was built against this branch, and manually verified that it was able to run the Remote Config testapp on Windows from a folder containing international characters.

(The Unity SDK built against head is unable to load the google-services.json file from a directory with international characters.)


Type of Change

Place an x the applicable box:

  • Bug fix. Add the issue # below if applicable.
  • New feature. A non-breaking change which adds functionality.
  • Other, such as a build process or documentation change.

Notes

  • Bug fixes and feature changes require an update to the Release Notes section of release_build_files/readme.md.
  • Read the contribution guidelines CONTRIBUTING.md.
  • Changes to the public API require an internal API review. If you'd like to help us make Firebase APIs better, please propose your change in a feature request so that we can discuss it together.

@jonsimantov jonsimantov added the tests-requested: quick Trigger a quick set of integration tests. label Jul 11, 2023
@github-actions github-actions bot added tests: in-progress This PR's integration tests are in progress. and removed tests-requested: quick Trigger a quick set of integration tests. labels Jul 11, 2023
@github-actions
Copy link

github-actions bot commented Jul 11, 2023

Integration test with FLAKINESS (succeeded after retry)

Requested by @jonsimantov on commit 41dc1be
Last updated: Thu Jul 13 16:30 PDT 2023
View integration test log & download artifacts

Failures Configs
remote_config [TEST] [FLAKINESS] [Android] [1/3 os: ubuntu] [1/2 android_device: android_target]
(1 failed tests)  FirebaseRemoteConfigTest.TestAddOnConfigUpdateListener

Add flaky tests to go/fpl-cpp-flake-tracker

@github-actions github-actions bot added the tests: failed This PR's integration tests failed. label Jul 12, 2023
@firebase-workflow-trigger firebase-workflow-trigger bot removed the tests: in-progress This PR's integration tests are in progress. label Jul 12, 2023
bool loaded_options = false;
#if FIREBASE_PLATFORM_WINDOWS
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: For testing, if you change this line to "#if 0", the new unit tests fail (as expected). With it as-is, the tests pass.

@github-actions github-actions bot added tests: in-progress This PR's integration tests are in progress. and removed tests: failed This PR's integration tests failed. labels Jul 12, 2023
@jonsimantov jonsimantov changed the title Convert path to UTF-16 before loading, for google services JSON. Convert path from UTF-8 to UTF-16 before loading, for google services JSON. Jul 12, 2023
@jonsimantov jonsimantov marked this pull request as ready for review July 12, 2023 23:55
@github-actions github-actions bot added the tests: failed This PR's integration tests failed. label Jul 12, 2023
@jonsimantov jonsimantov added the tests-requested: quick Trigger a quick set of integration tests. label Jul 13, 2023
@github-actions github-actions bot removed tests-requested: quick Trigger a quick set of integration tests. tests: failed This PR's integration tests failed. labels Jul 13, 2023
@jonsimantov jonsimantov enabled auto-merge (squash) July 13, 2023 01:01
@github-actions github-actions bot added the tests: failed This PR's integration tests failed. label Jul 13, 2023
@firebase-workflow-trigger firebase-workflow-trigger bot removed the tests: in-progress This PR's integration tests are in progress. label Jul 13, 2023
@jonsimantov jonsimantov added the tests-requested: quick Trigger a quick set of integration tests. label Jul 13, 2023
@github-actions github-actions bot added tests: in-progress This PR's integration tests are in progress. and removed tests-requested: quick Trigger a quick set of integration tests. tests: failed This PR's integration tests failed. labels Jul 13, 2023
@jonsimantov jonsimantov changed the title Convert path from UTF-8 to UTF-16 before loading, for google services JSON. Windows: Convert path from UTF-8 to UTF-16 before loading, for google services JSON. Jul 13, 2023
@jonsimantov jonsimantov changed the title Windows: Convert path from UTF-8 to UTF-16 before loading, for google services JSON. Windows: Convert path from UTF-8 to UTF-16 before loading google-services.json Jul 13, 2023
@github-actions github-actions bot added the tests: succeeded This PR's integration tests succeeded. label Jul 13, 2023
@firebase-workflow-trigger firebase-workflow-trigger bot removed the tests: in-progress This PR's integration tests are in progress. label Jul 13, 2023
@jonsimantov jonsimantov merged commit 41dc1be into main Jul 13, 2023
30 of 31 checks passed
@github-actions github-actions bot added tests: in-progress This PR's integration tests are in progress. tests: succeeded This PR's integration tests succeeded. and removed tests: succeeded This PR's integration tests succeeded. labels Jul 13, 2023
@firebase-workflow-trigger firebase-workflow-trigger bot removed the tests: in-progress This PR's integration tests are in progress. label Jul 13, 2023
tom-andersen pushed a commit that referenced this pull request Jul 17, 2023
… JSON. (#1383)

* Convert path to UTF-16 before loading, for google services JSON.

* When testing on desktop, use a folder with i18l characters.

* Add App Desktop test, and JSON parsing from international path.

* Format code.

* Clean up test code.

* Remove debug code.

* Update copyright year.

* Add release note.

* Whitespace.

* Format.

* Add missing header for rmdir, mkdir, etc.

* Fix C system call syntax.

* Add missing directory mode.
@firebase firebase locked and limited conversation to collaborators Aug 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tests: succeeded This PR's integration tests succeeded.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants