Preprocess function for body field? I have a client with a D8 site who wants curly quotes and apostrophes on all rendered content. I was able to do this for the page titles with this preprocess function:

function mytheme_preprocess_page_title(&amp;$variables) {
// Load the node entity from the current route
if ($node = \Drupal::request()-&gt;get('node')) {

    // Get the title
    $title = $node-&gt;getTitle();

    // Replace left quotes
    $title = preg_replace('/"(?=\w)/', '&amp;ldquo;', $title);

    // Replace right quotes
    $title = preg_replace('/(?&lt;=\w)"/', '&amp;rdquo;', $title);

    // Replace single quote/apostrophe
    $title = str_replace("'", '&amp;rsquo;', $title);

    // Return the title variable
    $variables['title'] = t($title);
}
}


Is there a way to do this for the body field as well? hook_preprocess_field isn't getting me anywhere.
Instead of using a preprocess function, you could accomplish the desired behavior using CSS.

Using the ::before and ::after selectors you can insert additional content. This content could be the textual " character (i.e., content: '"';) or you could display it as an (inline-)block, provide width, height, margin and padding and set a background image.

For example:

.field--name-body {
  padding-left: 1em;
  padding-right: 1em;
}

.field--name-body::before {
  content: '"';
  position: absolute;
  top: 0;
  left: 0;
}

.field--name-body::after {
  content: '"';
  position: absolute;
  right: 0;
  bottom: 0;
}


This creates some space around the body field and provides " characters at the top left and bottom right location.