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

Invalid "UTF-8" string in Bakery locale:compare #1265

Open
lcharette opened this issue Sep 15, 2024 · 2 comments
Open

Invalid "UTF-8" string in Bakery locale:compare #1265

lcharette opened this issue Sep 15, 2024 · 2 comments
Assignees
Labels
confirmed bug Something isn't working
Milestone

Comments

@lcharette
Copy link
Member

Affected sprinkle or package

userfrosting/sprinkle-core

UserFrosting or package Version

5.1.x

Debug Data

N/A

Chat Discussion (optional)

No response

Description

Continuation from : #1263


The output of php bakery locale:compare -l en_US -r pt_BR shows

=================
Comparing `en_US` with `pt_BR`
------------------------------
Comparison between Brazilian portuguese and English
---------------------------------------------------
In` ByteString.php line 444:
  Invalid "UTF-8" string.

So I added error logging just before the error message to identify the string: string(59) "�lido. Escolha um nome diferente, ou clique em 'sugestão'."

Searching for that string:
ack 'Escolha um nome diferente' . app/sprinkles/sprinkle-account/app/locale/pt_BR/messages.php 144: 'NOT_AVAILABLE' => 'Usuário <strong>{{user_name}}</strong> não é válido. Escolha um nome diferente, ou clique em \'sugestão\'.',

So the error is coming from v**á**lido in the string above.

Running a similar comparison using a different language also results in errors, eg php bakery locale:compare -l en_US -r fr_FR shows an error for string(20) "� la page d'accueil."

Steps To Reproduce

No response

@lcharette lcharette changed the title Baker Invalid "UTF-8" string in Bakery locale:compare Sep 15, 2024
@lcharette lcharette self-assigned this Sep 15, 2024
@lcharette lcharette added the confirmed bug Something isn't working label Sep 15, 2024
@lcharette lcharette added this to the 5.1.x milestone Sep 15, 2024
@lcharette
Copy link
Member Author

Issue seems to come from symfony/console : https://github.com/symfony/console/blob/180385075907fdd2aab2bbea378094eaa235199e/Formatter/OutputFormatter.php#L163

substr should be mb_substr : https://www.php.net/manual/en/function.substr.php#90581; https://stackoverflow.com/a/56238294/445757

UF code and language files doesn't seems to be the problem here. Seams more of an issue with Symfony. When wrapping the text to display in the console, Symfony uses substr.

I'll see if I can open an issue on their side.

@lcharette
Copy link
Member Author

Ref : symfony/symfony#58286

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed bug Something isn't working
Projects
Status: In Progress
Development

No branches or pull requests

1 participant