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

fixed incorrect titleizing of unicode string #68

Merged
merged 1 commit into from
Feb 24, 2023
Merged

Conversation

sio4
Copy link
Member

@sio4 sio4 commented Feb 24, 2023

What is being done in this PR?

  • fixed incorrect Titleize() of Unicode string
  • it fixes incorrect Humanize() which is now depends on Titleize()

fixes #67

What are the main choices made to get to this solution?

The previous code uses rune(part[0]) to pick the first character of the string but this is incorrect usage of the rune type. It should be []rune(part)[0]. We can also consider using golang.org/x/text module to handle this issue better in the future.

What was discovered while working on it? (Optional)

Titleize() ignores a part that starts with a special character such as `, * so the result will be:

  • "using rune correctly" --> "Using rune Correctly" (which is fine)
  • "what a wonderful world" --> "What A wonderful World" (which is odd to me)

We need to reconsider the design.

@sio4 sio4 added the bug Something isn't working label Feb 24, 2023
@sio4 sio4 added this to the v1.0.2 milestone Feb 24, 2023
@sio4 sio4 requested a review from a team February 24, 2023 14:44
@sio4 sio4 self-assigned this Feb 24, 2023
@sio4 sio4 modified the milestones: v2.0.0, v1.1.0 Feb 24, 2023
@sio4 sio4 merged commit 6ae7779 into main Feb 24, 2023
@sio4 sio4 deleted the bugfix-titlerize-unicode branch February 24, 2023 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: Regression in Humanize with unicode accents
1 participant