# Windows Escape Character Issue

**URL:** <https://forum.ansible.com/t/windows-escape-character-issue/38019>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [May 23, 2023, 1:49am UTC](https://forum.ansible.com/t/windows-escape-character-issue/38019 "2023-05-23T01:49:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Huskers79](https://avatars.discourse-cdn.com/v4/letter/h/d78d45/32.png) [@Huskers79](https://forum.ansible.com/u/Huskers79)\
**Post date:** [May 23, 2023, 1:49am UTC](https://forum.ansible.com/t/windows-escape-character-issue/38019/1 "2023-05-23T01:49:30Z")

</div>

Good day,

I’m utilizing slurp to pull an XML file from a remote Windows host to lookup some values. In the file there are a couple of Windows paths that when grabbed via regex\_search are returned with various escape sequences. For example, \a becomes \u0007.

Any ideas how I can resolve the below? I cannot install anything on the remote host, and I cannot pull files locally. This rules out using any of the XML modules.

Example for clarity:

file.xml:

\<?xml version="1.0" encoding="utf-8"?\> ... \\somewhere.com\adata\aclusters\bytes ...

Task:

- name: Create dictionary of values from test.xml  
ansible.builtin.set\_fact:  
file\_xml\_data: ‘{{ file\_xml\_data | default({}) | combine({item.key: item.value}) }}’  
loop:  
…
- “{ ‘key’: ‘cifs\_share’, ‘value’:  
‘{{ file\_xml | regex\_search(’(.+)\</‘, ‘\1’) | first }}’ }”

…

Appreciate any ideas you may have.

Thank you.

---

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [May 26, 2023, 5:18pm UTC](https://forum.ansible.com/t/windows-escape-character-issue/38019/2 "2023-05-26T17:18:45Z")

</div>

Hii

---

<div class="post-metadata">

**Author:** ![Huskers79](https://avatars.discourse-cdn.com/v4/letter/h/d78d45/32.png) [@Huskers79](https://forum.ansible.com/u/Huskers79)\
**Post date:** [May 26, 2023, 5:40pm UTC](https://forum.ansible.com/t/windows-escape-character-issue/38019/3 "2023-05-26T17:40:32Z")

</div>

Correct. The control node is an Ansible Tower server that we have limited access to.

---

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [May 26, 2023, 6:03pm UTC](https://forum.ansible.com/t/windows-escape-character-issue/38019/4 "2023-05-26T18:03:32Z")

</div>

That indeed does not leave much.  
I'm not sure but the problem may be that you're using the quoted json  
style to define your list of key/values.  
If I lay that out as basic yaml (same data structure, but a bit  
cleaner to look at), it does seem to work for me:

---

<div class="post-metadata">

**Author:** ![Huskers79](https://avatars.discourse-cdn.com/v4/letter/h/d78d45/32.png) [@Huskers79](https://forum.ansible.com/u/Huskers79)\
**Post date:** [May 26, 2023, 6:08pm UTC](https://forum.ansible.com/t/windows-escape-character-issue/38019/5 "2023-05-26T18:08:28Z")

</div>

Thank you. I’ll give this a whirl next week.
