oppia-android icon indicating copy to clipboard operation
oppia-android copied to clipboard

Configure Default Encoding and Line Endings for the Repository

Open adhiamboperes opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe.

Some of our contributors on Windows are experiencing build failures because they are using default windows encoding. This is causing build errors because some of the comments in the OppiaLanguage proto file includes Unicode characters and must be encoded in UTF-8 by default. Here is an example .gitattributes file from oppia-web

The compiler behaviour is explained in https://github.com/oppia/oppia-android/discussions/4984#discussioncomment-5931618.

Describe the solution you'd like

We need to create a .gitattributes file per https://stackoverflow.com/a/48908993/3689782 that can ensure everyone is always using UTF-8 during checkout & push.

We also want to fix line-ending consistency per https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings, which means setting autocrlf for everyone by default to avoid people running into line ending issues if they don't have autocrlf configured locally.

Describe alternatives you've considered

  1. Instructing the contributors configure their local environment to use UTF-8 by default before cloning the repository.
  2. Providing instructions to forcibly convert all checked out repository files to UTF-8.

Both options create additional setup work for new contributors, unnecessarily increasing onboarding complexity.

Additional context

Operating System

Windows 11

Android Studio Version

Android Studio Flamingo | 2022.2.1 Patch 1

RAM size

16 GB

Free disk space

300 GB

Which step are you stuck on?

image

Error Log

D:\Projects\Android\oppia-android\model\build\generated\source\proto\main\java\org\oppia\android\app\model\OppiaLanguage.java:25: error: unmappable character for encoding Cp1252
   * Corresponds to the Arabic (اَلْعَرَب�?يَّة�?‎) macro language. IETF BCP 47 language tag: ar.
                                                   ^
D:\Projects\Android\oppia-android\model\build\generated\source\proto\main\java\org\oppia\android\app\model\OppiaLanguage.java:25: error: unmappable character for encoding Cp1252
   * Corresponds to the Arabic (اَلْعَرَب�?يَّة�?‎) macro language. IETF BCP 47 language tag: ar.
                                                             ^
D:\Projects\Android\oppia-android\model\build\generated\source\proto\main\java\org\oppia\android\app\model\OppiaLanguage.java:41: error: unmappable character for encoding Cp1252
   * Corresponds to the Hindi (हिन�?दी) macro language. IETF BCP 47 language tag: hi.
                                          ^
D:\Projects\Android\oppia-android\model\build\generated\source\proto\main\java\org\oppia\android\app\model\OppiaLanguage.java:92: error: unmappable character for encoding Cp1252
   * Corresponds to the Arabic (اَلْعَرَب�?يَّة�?‎) macro language. IETF BCP 47 language tag: ar.
                                                   ^
D:\Projects\Android\oppia-android\model\build\generated\source\proto\main\java\org\oppia\android\app\model\OppiaLanguage.java:92: error: unmappable character for encoding Cp1252
   * Corresponds to the Arabic (اَلْعَرَب�?يَّة�?‎) macro language. IETF BCP 47 language tag: ar.
                                                             ^
D:\Projects\Android\oppia-android\model\build\generated\source\proto\main\java\org\oppia\android\app\model\OppiaLanguage.java:108: error: unmappable character for encoding Cp1252
   * Corresponds to the Hindi (हिन�?दी) macro language. IETF BCP 47 language tag: hi.
                                          ^

Approaches already used to resolve the issue

https://github.com/oppia/oppia-android/discussions/4966#discussioncomment-5903751

Originally posted by @jkugsiya in https://github.com/oppia/oppia-android/discussions/4984

adhiamboperes avatar May 23 '23 00:05 adhiamboperes

I'm unassigning myself from this issue for now as I'm currently focusing on the Bazel-related tasks. I may not have sufficient time to address this promptly, and I don't want to hold up anyone else who might be able to work on it. I'll keep an eye on unassigned issues and see if I can tackle them later.

Rd4dev avatar May 08 '24 07:05 Rd4dev