# Bug: Can't copy from UART output if output includes NULL character

**URL:** <https://forum.qoitech.com/t/bug-cant-copy-from-uart-output-if-output-includes-null-character/270>\
**Category:** Support\
**Created:** [February 26, 2019, 4:13am UTC](https://forum.qoitech.com/t/bug-cant-copy-from-uart-output-if-output-includes-null-character/270 "2019-02-26T04:13:05Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnflux](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@johnflux](https://forum.qoitech.com/u/johnflux)\
**Post date:** [February 26, 2019, 4:13am UTC](https://forum.qoitech.com/t/bug-cant-copy-from-uart-output-if-output-includes-null-character/270/1 "2019-02-26T04:13:05Z")

</div>

Edit: The bug is actually that uart included the null character. Previously I wrote:

If the UART output line says, like:

\*\*\*\*\* Booting \*\*\*\*\*

Then it’s not possible to copy to the clipboard.

---

<div class="post-metadata">

**Author:** ![wj1](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.qoitech.com/wj1/32/35_2.png) [@wj1](https://forum.qoitech.com/u/wj1)\
**Post date:** [February 26, 2019, 8:08am UTC](https://forum.qoitech.com/t/bug-cant-copy-from-uart-output-if-output-includes-null-character/270/2 "2019-02-26T08:08:52Z")

</div>

That sounds really odd! I’m not immediately able to reproduce this behavior using that log text though. Is it enough that the log contains that text or is the copy operation misbehaving when that text is part of the selection? Are you ending up with an empty clipboard or is “just” that part missing?

What OS are you running, and would it be possible for you to attach a small project containing the log you have difficulty copying? You can either attach the project here or create a case.

---

<div class="post-metadata">

**Author:** ![johnflux](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@johnflux](https://forum.qoitech.com/u/johnflux)\
**Post date:** [February 26, 2019, 8:32am UTC](https://forum.qoitech.com/t/bug-cant-copy-from-uart-output-if-output-includes-null-character/270/3 "2019-02-26T08:32:50Z")

</div>

The selection has to include that line. What happens is the clipboard includes everything up to that line includes the \*\*\*\*\*

Note that it only fails if you paste into another program - e.g. notepad, firefox

If I paste into Otii command input, then it works!

It is most bizarre

---

<div class="post-metadata">

**Author:** ![wj1](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.qoitech.com/wj1/32/35_2.png) [@wj1](https://forum.qoitech.com/u/wj1)\
**Post date:** [February 26, 2019, 8:46am UTC](https://forum.qoitech.com/t/bug-cant-copy-from-uart-output-if-output-includes-null-character/270/4 "2019-02-26T08:46:48Z")

</div>

Most bizarre, I agree! I tried it on a Windows machine by looping Otii Arc TX to RX and manually sending the text, it copies into Notepad just fine even there, see attached screenshot:

 ![uart-stars](https://europe1.discourse-cdn.com/flex017/uploads/qoitech/original/1X/7ed9f4220071e9351ade052668f8c35431d49541.png)  
Are you running this on Windows 10 or Windows 7? (figured it had to be Windows due to Notepad)

---

<div class="post-metadata">

**Author:** ![johnflux](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@johnflux](https://forum.qoitech.com/u/johnflux)\
**Post date:** [February 26, 2019, 9:38am UTC](https://forum.qoitech.com/t/bug-cant-copy-from-uart-output-if-output-includes-null-character/270/5 "2019-02-26T09:38:37Z")

</div>

This in on Windows 10.

I don’t know it doesn’t reproduce for you :-/

The exact string I actually have is:

\*\*\*\*\* Booting Zephyr OS 1.5.0-6-gc7668d6b4 \*\*\*\*\*

I’ve always had this problem, and have been using otii daily for for weeks (i.e the computer has rebooted many times, etc)

Hmmmm, I wonder though - this is the very first message that appears - I wonder if the is sending some hidden garbage character… that would actually explain a lot.

---

<div class="post-metadata">

**Author:** ![wj1](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.qoitech.com/wj1/32/35_2.png) [@wj1](https://forum.qoitech.com/u/wj1)\
**Post date:** [February 26, 2019, 9:41am UTC](https://forum.qoitech.com/t/bug-cant-copy-from-uart-output-if-output-includes-null-character/270/6 "2019-02-26T09:41:04Z")

</div>

Can you save the project and attach it here (or in a case), then I can take a look if there’s some garbage that snuck in.

---

<div class="post-metadata">

**Author:** ![johnflux](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@johnflux](https://forum.qoitech.com/u/johnflux)\
**Post date:** [February 26, 2019, 9:43am UTC](https://forum.qoitech.com/t/bug-cant-copy-from-uart-output-if-output-includes-null-character/270/7 "2019-02-26T09:43:36Z")

</div>

[tag.otii](https://europe1.discourse-cdn.com/flex017/uploads/qoitech/original/1X/0549b630fcb85e45a25b0d04ab8cae9013955cde.otii) (245.0 KB)

---

<div class="post-metadata">

**Author:** ![wj1](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.qoitech.com/wj1/32/35_2.png) [@wj1](https://forum.qoitech.com/u/wj1)\
**Post date:** [February 26, 2019, 9:52am UTC](https://forum.qoitech.com/t/bug-cant-copy-from-uart-output-if-output-includes-null-character/270/8 "2019-02-26T09:52:58Z")

</div>

So there _is_ a NUL byte as the very first character on that line. We’re looking into this handling right now as we’ve had issues with NUL bytes coming in over regular USB-UARTs. Apparently Windows needs to have some (optional) filtering applied before copying to the clipboard. I’ll look into this some more!
