# Write Better with Vale: Is is possible to copy & paste code from the epub version without invisible characters?

**URL:** <https://forum.devtalk.com/t/write-better-with-vale-is-is-possible-to-copy-paste-code-from-the-epub-version-without-invisible-characters/215791>\
**Category:** PragProg Customers\
**Tags:** question, book-write-better-with-vale\
**Created:** [23 September 2025 13:25 UTC](https://forum.devtalk.com/t/write-better-with-vale-is-is-possible-to-copy-paste-code-from-the-epub-version-without-invisible-characters/215791 "2025-09-23T13:25:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![s2k](https://forum.devtalk.com/user_avatar/forum.devtalk.com/s2k/32/2784_2.png) [@s2k](https://forum.devtalk.com/u/s2k)\
**Post date:** [23 September 2025 13:25 UTC](https://forum.devtalk.com/t/write-better-with-vale-is-is-possible-to-copy-paste-code-from-the-epub-version-without-invisible-characters/215791/1 "2025-09-23T13:25:35Z")

</div>

### Context

Hardware & OS:

> OS: macOS Tahoe 26.0 arm64  
> Host: MacBook Pro

### Observation

One of the code snippets as seen in epub is this:

 ![vale-ini-screenshot|320](https://forum.devtalk.com/uploads/default/original/2X/1/1e6f899f0d1505596ed2825367d288e58a7c3f46.png)

When I mark the code and copy it into a text editor, I get

> “​ StylesPath = ​../styles​​ MinAlertLevel = ​suggestion​​ ​ ​[\*.html]​​ BasedOnStyles = ​Vale​​ Vale.Spelling = ​error​”
> 
> Excerpt From  
> Write Better with Vale  
> Brian P. Hogan  
> This material may be protected by copyright.

…and that’s fine. Removing the lower part and reformatting the part in the double quotes is easy enough. After doing that, I’m left with:

```ini
StylesPath = ​../styles​​
MinAlertLevel = ​suggestion​​

[*.html]​​
BasedOnStyles = ​Vale​​
Vale.Spelling = ​error​

```

This _looks_ good, but alas it isn’t: Running `vale .` in (an empty) folder containing only this ini file, I get:

```bash
> vale .
E100 [NewE201] Runtime error
The path ‘/Users/stephan/dev/vale_example_project/​../styles​​’ does not exist.
Execution stopped with code 1.

```

It took me a while to find the issue.  
Using `cat`on the file doesn’t show anything suspecting:

```bash
> cat .vale.ini
StylesPath = ​../styles
MinAlertLevel = ​suggestion

[*.html]
BasedOnStyles = ​Vale
Vale.Spelling = ​error

```

Dumping the file to show the characters _and_ hex codes, I get this:

```bash
> fd -w16 .vale.ini
.vale.ini
53 74 79 6c 65 73 50 61 74 68 20 3d 20 e2 80 8b | S t y l e s P a t h ␠ = ␠
2e 2e 2f 73 74 79 6c 65 73 e2 80 8b e2 80 8b 0a | . . / s t y l e s ​ ​ ␊
4d 69 6e 41 6c 65 72 74 4c 65 76 65 6c 20 3d 20 | M i n A l e r t L e v e l ␠ = ␠
e2 80 8b 73 75 67 67 65 73 74 69 6f 6e e2 80 8b | ​ s u g g e s t i o n
e2 80 8b 0a 0a 5b 2a 2e 68 74 6d 6c 5d e2 80 8b | ​ ␊ ␊ [* . h t m l]
e2 80 8b 0a 42 61 73 65 64 4f 6e 53 74 79 6c 65 | ​ ␊ B a s e d O n S t y l e
      73 20 3d 20 e2 80 8b 56 61 6c 65 e2 80 8b | s ␠ = ␠ ​ V a l e
e2 80 8b 0a 56 61 6c 65 2e 53 70 65 6c 6c 69 6e | ​ ␊ V a l e . S p e l l i n
67 20 3d 20 e2 80 8b 65 72 72 6f 72 e2 80 8b 0a | g ␠ = ␠ ​ e r r o r ​ ␊

```

(`fd`is for ‘file dump’, a Ruby tool I wrote [and available at [https://github.com/s2k/fd\](https://github.com/s2k/fd%5C)])

Aha! There are sequences of `e2 80 8b` that `vale` can’t cope with.  
Now, this sequence (in UTF-8) is a ‘zero width space’ (→ [U+200B ZERO WIDTH SPACE: ​ – Unicode – Codepoints](https://codepoints.net/U+200B?lang=en) ) which also explains why it’s not visible.

My question is: Is it possible to not put this zero-width-space in the copied code snippet (or not in the epub file)?

Cheers

Stephan

---

<div class="post-metadata">

**Author:** ![Margaret](https://forum.devtalk.com/user_avatar/forum.devtalk.com/margaret/32/237_2.png) [@Margaret](https://forum.devtalk.com/u/Margaret)\
**Post date:** [23 September 2025 15:31 UTC](https://forum.devtalk.com/t/write-better-with-vale-is-is-possible-to-copy-paste-code-from-the-epub-version-without-invisible-characters/215791/2 "2025-09-23T15:31:23Z")

</div>

IDK if this helps you, but there is a zip file with the code for the vale.ini file on the book’s web page: [https://media.pragprog.com/titles/bhvale/code/bhvale-code.zip](https://media.pragprog.com/titles/bhvale/code/bhvale-code.zip)

---

<div class="post-metadata">

**Author:** ![bphogan](https://forum.devtalk.com/user_avatar/forum.devtalk.com/bphogan/32/756_2.png) [@bphogan](https://forum.devtalk.com/u/bphogan)\
**Post date:** [25 September 2025 18:32 UTC](https://forum.devtalk.com/t/write-better-with-vale-is-is-possible-to-copy-paste-code-from-the-epub-version-without-invisible-characters/215791/3 "2025-09-25T18:32:02Z")

</div>

I’m going to look through the example files to ensure this isn’t actually in there myself. Thanks for reporting this.

---

<div class="post-metadata">

**Author:** ![s2k](https://forum.devtalk.com/user_avatar/forum.devtalk.com/s2k/32/2784_2.png) [@s2k](https://forum.devtalk.com/u/s2k)\
**Post date:** [29 September 2025 13:34 UTC](https://forum.devtalk.com/t/write-better-with-vale-is-is-possible-to-copy-paste-code-from-the-epub-version-without-invisible-characters/215791/4 "2025-09-29T13:34:23Z")

</div>

After reporting it, it took me a while to realise I could create a `vale` rule/config for this:

File name: `…/styles/Custom/NoZeroWidthSpaces.yml`

```ruby
# Styles/Custom/NoZeroWidthSpace.yml
extends: existence
message: "Avoid using zero-width or invisible characters ({{match}})."
level: error
scope: raw
raw:
  - '[\u200B\u200C\u200D\u2060\uFEFF]'

```

With a `.vale.ini` like this:

```ini
StylesPath = styles

[*.md]
BasedOnStyles = Custom

```

I get some messages from _Vale_ when running this against some copy-&-pasted code example from the book.

YAY, I learned something. 😃👍

---

<div class="post-metadata">

**Author:** ![bphogan](https://forum.devtalk.com/user_avatar/forum.devtalk.com/bphogan/32/756_2.png) [@bphogan](https://forum.devtalk.com/u/bphogan)\
**Post date:** [9 October 2025 04:20 UTC](https://forum.devtalk.com/t/write-better-with-vale-is-is-possible-to-copy-paste-code-from-the-epub-version-without-invisible-characters/215791/5 "2025-10-09T04:20:09Z")

</div>

@s2k that just makes me smile so much. What a great application of the book’s content.

This is exactly how I use Vale at $dayJob… to find things we want to fix.

FWIW I verified that there’s nothing in the original code that causes this, so it’s something I’ll have to raise with the publisher.
