# Extra character (carriage return?) when decoding base64-encoded string?

**URL:** <https://forum.ansible.com/t/extra-character-carriage-return-when-decoding-base64-encoded-string/23365>\
**Category:** Ansible Project\
**Created:** [January 3, 2017, 3:06pm UTC](https://forum.ansible.com/t/extra-character-carriage-return-when-decoding-base64-encoded-string/23365 "2017-01-03T15:06:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [January 3, 2017, 3:06pm UTC](https://forum.ansible.com/t/extra-character-carriage-return-when-decoding-base64-encoded-string/23365/1 "2017-01-03T15:06:45Z")

</div>

Dear all,

I am not an expert on base64, but I guess this might be similar to  
this issue:  
\<[https://github.com/ansible/ansible/issues/5262&gt](https://github.com/ansible/ansible/issues/5262&gt);

I have a variable myvariable that contains a base64-encoded string  
generated by this command:

cat binary\_file | base64

I then use the copy-module to create the binary file:

copy: content="{{ myvariable | b64decode }}" ...

I then get a different file than what I had before, and it seems it is  
just one character that is added.

I also tried to add "...|trim" to content=..., but to no avail.

Any hints?

Johannes

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [January 11, 2017, 9:00pm UTC](https://forum.ansible.com/t/extra-character-carriage-return-when-decoding-base64-encoded-string/23365/2 "2017-01-11T21:00:15Z")

</div>

[https://github.com/ansible/ansible/issues/20150](https://github.com/ansible/ansible/issues/20150)

Johannes
