## Problem description

I've created a new Quarto Book project under `~/tmp_quarto_book` via RStudio as [described here](https://quarto.org/docs/books/#rstudio).

While this renders fine via the Quarto CLI...

```sh
quarto render --to pdf
```

<details><summary>Output</summary>

```
[1/4] index.qmd


processing file: index.rmarkdown
  |.......................                                               |  33%
  ordinary text without R code

  |...............................................                       |  67%
label: unnamed-chunk-1
  |......................................................................| 100%
  ordinary text without R code


output file: index.knit.md

[2/4] intro.qmd


processing file: intro.rmarkdown
  |.......................                                               |  33%
  ordinary text without R code

  |...............................................                       |  67%
label: unnamed-chunk-1
  |......................................................................| 100%
  ordinary text without R code


output file: intro.knit.md

[3/4] summary.qmd


processing file: summary.rmarkdown
  |.......................                                               |  33%
  ordinary text without R code

  |...............................................                       |  67%
label: unnamed-chunk-1
  |......................................................................| 100%
  ordinary text without R code


output file: summary.knit.md

[4/4] references.qmd

pandoc 
  to: latex
  output-file: index.tex
  standalone: true
  toc: true
  number-sections: true
  top-level-division: chapter
  pdf-engine: xelatex
  variables:
    graphics: true
    tables: true
  default-image-extension: pdf
  filters:
    - crossref
    - citeproc
  
metadata
  crossref:
    chapters: true
  documentclass: scrreprt
  papersize: letter
  classoption:
    - DIV=11
    - numbers=noendperiod
  header-includes:
    - '\KOMAoption{captions}{tableheading}'
  block-headings: true
  bibliography:
    - references.bib
  editor: visual
  title: tmp_quarto_book
  author: Jane Doe
  date: 5/16/2022
  
running xelatex - 1
  This is XeTeX, Version 3.141592653-2.6-0.999994 (TeX Live 2022) (preloaded format=xelatex)
   restricted \write18 enabled.
  entering extended mode
  
running xelatex - 2
  This is XeTeX, Version 3.141592653-2.6-0.999994 (TeX Live 2022) (preloaded format=xelatex)
   restricted \write18 enabled.
  entering extended mode
  

Output created: _book/tmp_quarto_book.pdf
```

</details>

... an error message is shown when the rendering is performed via RStudio's <kbd>Render Book</kbd> button (to `PDF Format`):

<details><summary>Output</summary>

```
Rendering:
[1/4] index.qmd


processing file: index.rmarkdown
  |.......................                                               |  33%
  ordinary text without R code

  |...............................................                       |  67%
label: unnamed-chunk-1
  |......................................................................| 100%
  ordinary text without R code


output file: index.knit.md

[2/4] intro.qmd


processing file: intro.rmarkdown
  |.......................                                               |  33%
  ordinary text without R code

  |...............................................                       |  67%
label: unnamed-chunk-1
  |......................................................................| 100%
  ordinary text without R code


output file: intro.knit.md

[3/4] summary.qmd


processing file: summary.rmarkdown
  |.......................                                               |  33%
  ordinary text without R code

  |...............................................                       |  67%
label: unnamed-chunk-1
  |......................................................................| 100%
  ordinary text without R code


output file: summary.knit.md

[4/4] references.qmd

pandoc 
  to: latex
  output-file: index.tex
  standalone: true
  toc: true
  number-sections: true
  top-level-division: chapter
  pdf-engine: xelatex
  variables:
    graphics: true
    tables: true
  default-image-extension: pdf
  filters:
    - crossref
    - citeproc
  
metadata
  crossref:
    chapters: true
  documentclass: scrreprt
  papersize: letter
  classoption:
    - DIV=11
    - numbers=noendperiod
  header-includes:
    - '\KOMAoption{captions}{tableheading}'
  block-headings: true
  bibliography:
    - references.bib
  editor: visual
  title: tmp_quarto_book
  author: Jane Doe
  date: 5/16/2022
  
running xelatex - 1
  This is XeTeX, Version 3.141592653-2.6-0.999994 (TeX Live 2022) (preloaded format=xelatex)
   restricted \write18 enabled.
  entering extended mode
  
running xelatex - 2
  This is XeTeX, Version 3.141592653-2.6-0.999994 (TeX Live 2022) (preloaded format=xelatex)
   restricted \write18 enabled.
  entering extended mode
  

ERROR: InvalidData: stream did not contain valid UTF-8
```

</details>

I have no clue where the error **`InvalidData: stream did not contain valid UTF-8`** at the end stems from. The PDF seems to be built fine though.

## Setup

I use

- Ubuntu 22.04
- RStudio 2022.06.0-daily+406 "Spotted Wakerobin" Daily (5e9b6b93c1665966df7f5acca1cb9590f4e004e5, 2022-05-15) for Ubuntu Jammy
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.8 Chrome/69.0.3497.128 Safari/537.36
- Latest Quarto CLI installed from GitHub releases:
  ```sh
  $ apt list --installed quarto
  Listing... Done
  quarto/now 0.9.414 amd64 [installed,local]
  ```
2022-05-16T23:27:22Z
salim-b
closed
RStudio: `ERROR: InvalidData: stream did not contain valid UTF-8`
https://github.com/quarto-dev/quarto-cli/issues/902