# String rendering issue

**URL:** <https://forum.juce.com/t/string-rendering-issue/64746>\
**Category:** General JUCE discussion\
**Created:** [December 28, 2024, 11:38pm UTC](https://forum.juce.com/t/string-rendering-issue/64746 "2024-12-28T23:38:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nigelstanford](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/nigelstanford/32/10142_2.png) [@nigelstanford](https://forum.juce.com/u/nigelstanford)\
**Post date:** [December 28, 2024, 11:38pm UTC](https://forum.juce.com/t/string-rendering-issue/64746/1 "2024-12-28T23:38:59Z")

</div>

I’m having a strange issue with rendering UTF8 special characters.  
They do render correctly, but when I use certain ones, any character following a space is not drawn.

```auto
        g.drawFittedText(CharPointer_UTF8("ø Test"), text_area.toNearestIntEdges(), Justification::left, 1, 1.0);
        g.drawFittedText(CharPointer_UTF8("ū Test"), text_area.toNearestIntEdges(), Justification::right, 1, 1.0);

```

![image](https://us1.discourse-cdn.com/flex026/uploads/juce/original/3X/e/d/ed41d64bf86202e780520c8216f0ee918fa1b075.png)

Does anyone know what I can do about this? Many thanks!

---

<div class="post-metadata">

**Author:** ![nigelstanford](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/nigelstanford/32/10142_2.png) [@nigelstanford](https://forum.juce.com/u/nigelstanford)\
**Post date:** [December 29, 2024, 12:00am UTC](https://forum.juce.com/t/string-rendering-issue/64746/2 "2024-12-29T00:00:39Z")

</div>

FYI this is in JUCE 7, I’ve just tested in JUCE 8 and it seems to be fixed.

---

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [November 4, 2025, 2:50pm UTC](https://forum.juce.com/t/string-rendering-issue/64746/3 "2025-11-04T14:50:02Z")

</div>

Just stumbled across this, and I see it in several places in the juce forum. I think a string literal is missing here.

`g.drawFittedText(CharPointer_UTF8("ø Test")...`

instead use

`g.drawFittedText(CharPointer_UTF8(u8"ø Test")...`

I don’t know if that was the original error, but it would be nice if the `CharPointer_UTF8`constructor would “jassert” if it includes invalid characters.

---

<div class="post-metadata">

**Author:** ![anthony-nicholls](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/anthony-nicholls/32/1246_2.png) [@anthony-nicholls](https://forum.juce.com/u/anthony-nicholls)\
**Post date:** [November 4, 2025, 4:28pm UTC](https://forum.juce.com/t/string-rendering-issue/64746/4 "2025-11-04T16:28:27Z")

</div>

Unfortunately even `u8"ø Test"` won’t work in all cases, as u8 only refers to the _execution character set_ not the _source character set_. Generally speaking I don’t recommend using any non-ASCII literals in source code. More information here [Technical Deep Dive: Unicode Literals - JUCE](https://juce.com/blog/tech-deep-dive-unicode-literals/).

---

<div class="post-metadata">

**Author:** ![Stela09](https://avatars.discourse-cdn.com/v4/letter/s/f1d935/32.png) [@Stela09](https://forum.juce.com/u/Stela09)\
**Post date:** [January 9, 2026, 8:18am UTC](https://forum.juce.com/t/string-rendering-issue/64746/5 "2026-01-09T08:18:10Z")

</div>

Totally agree. Ever since C++20 made u8 literals more strict, these kinds of issues have been popping up more. Having an internal check for valid UTF-8 sequences in the constructor would definitely save a lot of head-scratching for people moving between Windows and macOS.
