Skip to content

Replace culture sensitive string operations with invariant or ordinal#765

Merged
ManlyMarco merged 2 commits intomasterfrom
string-culture-invariant
Sep 27, 2025
Merged

Replace culture sensitive string operations with invariant or ordinal#765
ManlyMarco merged 2 commits intomasterfrom
string-culture-invariant

Conversation

@ManlyMarco
Copy link
Copy Markdown
Collaborator

This should have no functional difference under ja-JP and en-US cultures, but may fix some issues under other cultures that do weird things with . and such.

@ManlyMarco ManlyMarco requested a review from Copilot September 26, 2025 18:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR replaces culture-sensitive string operations with culture-invariant or ordinal comparisons to prevent issues in non-English locales where characters like "." might behave differently.

  • Updates IndexOf, LastIndexOf, and Compare string methods to use explicit StringComparison parameters
  • Replaces double.TryParse and ToString calls to use CultureInfo.InvariantCulture
  • Changes some string-based searches to character-based searches for better performance

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
StringExtensions.cs Updated GetBetween method to use InvariantCulture for string searches
UnityTypes.cs Changed dot search from string to character for better performance
ConnectionTrackingWebClient.cs Added culture-invariant string comparison for content-type header
TemplatingHelper.cs Updated string replacement logic to use InvariantCulture
TranslationFileLoadingContext.cs Fixed comment parsing and added ordinal comparison
TextureTranslationCache.cs Changed bracket searches from string to character
SimpleJson.cs (multiple files) Updated number parsing and formatting to use invariant culture
WWW.cs Added ordinal comparison for HTTP header parsing
PapagoTranslateEndpoint.cs Updated timestamp formatting to use invariant culture
Multiple translator files Updated HTML parsing to use ordinal comparisons and character searches

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ManlyMarco ManlyMarco requested a review from Copilot September 26, 2025 19:18
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ManlyMarco ManlyMarco merged commit a8a08b5 into master Sep 27, 2025
@ManlyMarco ManlyMarco deleted the string-culture-invariant branch September 27, 2025 18:40
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