High Performance PostgreSQL for Rails: Contains non-printing unicode characters

I found it challenging to use code examples from this book, particularly because the queries containing non-printing Unicode characters. E.g.,

epub book:

rideshare_development=> REINDEX ​INDEX​ index_users_on_email;
ERROR:  syntax error at or near "​INDEX​"
LINE 1: REINDEX ​INDEX​ index_users_on_email;
                ^
Time: 0.917 ms

pdf book:

rideshare_development=> REINDEX INDEX index_users_on_email;
REINDEX
Time: 5906.267 ms (00:05.906)

Is there any way, to create epub format book, with printing Unicode characters only?

Thanks a lot!
Viktor

1 Like

Hi there. Glad you’re running the code examples, and sorry to hear the epub format version has some issues. Are you copying and pasting examples from the epub version?

For this one it might be best to link to this issue, and reach out to support@pragprog.com for help or suggestions.

Generally they recommend downloading the code sample directory separately, and working with the text files from there versus copying and pasting from one of the ebook formats. Would that work for you?

Hi Andrew,

Thank you for your response and suggestion.

I understand that the recommended approach is to download the code sample directory separately and work with the text files from there.

However, I’m actually using the epub format because I primarily use a Kindle for reading. The book seems to be generally written with the approach of going to the posts and code on the web, which doesn’t work well for me as I often read while on the go with my Kindle and don’t have access to those resources.

My current approach is to read as much as possible in the book and take notes along the way. When I’m back at my notebook, I then start again with the examples and links to posts.

It’s not the best method, but it works to some extent. Ideally, I would prefer to have the examples directly in the book for convenience.

I would appreciate any further suggestions or adjustments that could make the code examples more accessible within the epub format.

Thank you again for your help and understanding.

Best regards,

Viktor

1 Like

Oh, I just realized that you can click on each example to download the code :blush:. Did I miss this feature because I’ve been using the book without internet access? Or is there an explanation for this in the book that I might have overlooked?

Anyway, downloading the examples does help solve this problem, as I will go back to the code on my notebook eventually.

Initially, I was looking for the files in the repository itself and was surprised not to find those examples there. It was a bit frustrating not to find those files directly. Now, with the link, I understand why they are not included. :smiley:

But isn’t the book repository the best place for those code examples?

1 Like

Glad you got it sorted out. I can see how it might be confusing having code snippets distributed with the book, and having code in the app repository. Thanks.

Just to continue this a little.

What you’re seeing in the epub are zero-width spaces.

We were forced to add them into code listings because of a bug in some ereaders where newlines get wrongly inserted between elements in <pre> sections. There’s no really good fix.

However, you should be able to simply click on the filename above the listing, which will download the code.

We keep the book code separate because we need to make sure that these links will still work 10 years from now…

Dave