Debian Codegraph @

docs/howto/special-chars.md

raw
1 # Handle special chars
2
3 * [Detect encoding](#detect-encoding)
4 * [Special chars](#special-chars)
5 * [Re-encode](#re-encode)
6
7 ---
8
9 ## Detect encoding
10
11 Text file encoding can be identified using, for example, `file -b <file-path>` or in vim
12 with `:set fileencoding`.
13
14 Here's an example of encoding that will fully work with dotdrop:
15 ```bash
16 $ file -b <some-file>
17 UTF-8 Unicode text, with escape sequences
18 ```
19
20 and another that will mislead the `compare` command and return false/inaccurate results:
21 ```bash
22 $ file -b <some-file>
23 ISO-8859 text, with escape sequences
24 ```
25
26 ## Special chars
27
28 ### CRLF
29
30 The use of dotfiles with DOS/Windows line endings (CRLF, `\r\n`) will result in
31 the comparison (`compare`) returning a difference where there is none.
32 This is due to Jinja2 stripping CRLF.
33
34 One solution is to use `dos2unix` to re-format the dotfiles before adding them
35 to dotdrop.
36
37 See <https://github.com/deadc0de6/dotdrop/issues/42>.
38
39 ### Non-Unicode chars
40
41 Jinja2 is not able to process non-Unicode chars (<https://jinja.palletsprojects.com/en/2.11.x/api/>). This means that dotfiles using non-Unicode chars can still be fully managed by dotdrop; however, when comparing the local file with the one stored in dotdrop, `compare` will return a difference even if there is none.
42
43 Either replace the non-Unicode chars (see below [Re-encode](#re-encode)) or accept the fact the comparison shows a difference while there's none.
44
45 See <https://github.com/deadc0de6/dotdrop/issues/42>.
46
47 ## Re-encode
48
49 To change an existing file's encoding, you can use `recode UTF-8 <filename>` (see [recode](https://linux.die.net/man/1/recode)) or in vim `:set fileencoding=utf-8`.