mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2026-10-28 11:44:37 +08:00
doc: document Windows path separators and UTF-8 locale
Add FAQ guidance for Git Bash path separators via `--path-separator` and the Windows UTF-8 system locale option. Closes #1667
This commit is contained in:
1 parent
756a945f65
commit
4c2362d359
1 file changed
+28
@@ -21,6 +21,7 @@
|
||||
* [When I run `rg`, why does it execute some other command?](#rg-other-cmd)
|
||||
* [How do I create an alias for ripgrep on Windows?](#rg-alias-windows)
|
||||
* [How do I create a PowerShell profile?](#powershell-profile)
|
||||
* [Why do paths and encoding look wrong in Git Bash on Windows?](#windows-paths-encoding)
|
||||
* [How do I pipe non-ASCII content to ripgrep on Windows?](#pipe-non-ascii-windows)
|
||||
* [How can I search and replace with ripgrep?](#search-and-replace)
|
||||
* [How is ripgrep licensed?](#license)
|
||||
@@ -829,6 +830,33 @@ Any PowerShell code in this file gets evaluated at the start of console. This
|
||||
way you can have own aliases to be created at start.
|
||||
|
||||
|
||||
<h3 name="windows-paths-encoding">
|
||||
Why do paths and encoding look wrong in Git Bash on Windows?
|
||||
</h3>
|
||||
|
||||
ripgrep prints file paths using the platform's native path separator (`\` on
|
||||
Windows). Under Git Bash, MSYS2, or Cygwin, that can look awkward next to
|
||||
Unix-style tools, and console locale settings can also garble non-ASCII
|
||||
output even though ripgrep is emitting the file bytes unchanged.
|
||||
|
||||
If you want forward slashes in printed paths when using those shells, set
|
||||
`--path-separator`. A common alias is:
|
||||
|
||||
```
|
||||
alias rg='rg --path-separator //'
|
||||
```
|
||||
|
||||
The double slash avoids Git Bash rewriting a single `/`.
|
||||
|
||||
If non-ASCII characters (for example umlauts in file contents) look wrong in
|
||||
a Windows console, try enabling the system UTF-8 locale. Note that this is
|
||||
a system-wide change and may affect other programs.
|
||||
|
||||
See also
|
||||
[Why does using a leading `/` on Windows fail?](#because-cygwin) and
|
||||
[How do I pipe non-ASCII content to ripgrep on Windows?](#pipe-non-ascii-windows)
|
||||
|
||||
|
||||
<h3 name="pipe-non-ascii-windows">
|
||||
How do I pipe non-ASCII content to ripgrep on Windows?
|
||||
</h3>
|
||||
|
||||
Reference in new issue
Block a user