Skip to content

Commit

Permalink
Merge pull request unoplatform#13890 from unoplatform/dev/jela/issue1…
Browse files Browse the repository at this point in the history
…3863

fix: property escape `%` in resw files
  • Loading branch information
jeromelaban authored Oct 4, 2023
2 parents 8adc8aa + e69047d commit 52c6091
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Uno.UI.RuntimeTests/MUX/Helpers/StringUtilTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public void When_StringUtil()
Validate_Formatting("test, icon", "%1!s!, icon", "test");
Validate_Formatting("test, 42 items", "%1!s!, %2!u! items", "test", 42);
Validate_Formatting("test, 42 test2", "%1!s!, %2!u! %3!s!", "test", 42, "test2");
Validate_Formatting("test %, 42% test2", "%1!s!, %2!u!%% %3!s!", "test %", 42, "test2");
Validate_Formatting("test, 42% test2", "%1!s!, %2!u!%% %3!s!", "test", 42, "test2");
}

private void Validate_Formatting(string expected, string format, params object[] args)
Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UI/Helpers/WinUI/StringUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ internal static string FormatString(string format, params object[] parms)
// the output string, as the C++ index is staring at 1.
list.Insert(0, null);

return string.Format(CultureInfo.CurrentCulture, dotnetFormat, list.ToArray());
return string.Format(CultureInfo.CurrentCulture, dotnetFormat.Replace("%%", "%"), list.ToArray());
}

[GeneratedRegex(@"\%(\d+)!.*?!", RegexOptions.Singleline)]
Expand Down

0 comments on commit 52c6091

Please sign in to comment.