Line break escape sequence (\R) documentation is incomplete
Open
Nobody has claimed this yet.
Extension: pcre
- Dominant language
- XML
- Stars
- 596
- Forks
- 890
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 55
Description
Description
The line break escape sequence (\R) seems to break certain UTF-8 characters, in this example ą.
The following code:
<?php
$line = "Urządzenie Z-Wave nie odpowiedziało.";
echo preg_replace("/\R+/", "\n", $line);
echo preg_replace("/[\n\r]+/", "\n", $line);
Resulted in this output:
Urz�
dzenie Z-Wave nie odpowiedziało.
Urządzenie Z-Wave nie odpowiedziało.
But I expected this output instead:
Urządzenie Z-Wave nie odpowiedziało.
Urządzenie Z-Wave nie odpowiedziało.
PHP Version
8.3.17/8.4.4
Operating System
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked PHP manual page for the line break escape sequence (\R), then run the provided PHP 8.3/8.4 example to reproduce the UTF-8 character corruption. Review the existing explanation of \R and document the behavior and relevant distinction from [\n\r]+ so the page accurately reflects the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100