# Search Field Text Encoding?

**URL:** <https://forum.xojo.com/t/search-field-text-encoding/67511>\
**Category:** General\
**Created:** [December 19, 2021, 12:10pm UTC](https://forum.xojo.com/t/search-field-text-encoding/67511 "2021-12-19T12:10:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lawrence\_Johnson](https://forum.xojo.com/letter_avatar_proxy/v4/letter/l/87869e/32.png) [@Lawrence\_Johnson](https://forum.xojo.com/u/Lawrence_Johnson)\
**Post date:** [December 19, 2021, 12:10pm UTC](https://forum.xojo.com/t/search-field-text-encoding/67511/1 "2021-12-19T12:10:55Z")

</div>

Before I raise this as a bug, is there a particular reason why the Search Field desktop control appears to be storing it’s contents as a 16-bit (UTF-16) string? I thought Xojo was meant to handle all internal strings in UTF-8?

I discovered this when I couldn’t work out why my URL query call wasn’t working correctly. Then when I did some debugging I found that the text content of the control was being stored as 16-bits per character. So the phrase “test” for example, was being urlencoded to t%00e%00s%00t%00 and not being understood by the server.

I’ve swapped back to using an ordinary Text Field control for now as I don’t really need to use the search field but thought I’d raise this in case anyone else has encountered it.

Tested with Xojo 2021r2.1 on Windows. I have not checked if Mac or Linux have this problem

---

<div class="post-metadata">

**Author:** ![Thom\_McGrath](https://forum.xojo.com/user_avatar/forum.xojo.com/thom_mcgrath/32/192_2.png) [@Thom\_McGrath](https://forum.xojo.com/u/Thom_McGrath)\
**Post date:** [December 19, 2021, 12:13pm UTC](https://forum.xojo.com/t/search-field-text-encoding/67511/2 "2021-12-19T12:13:16Z")

</div>

Mac does not have the problem, Linux unknown. Fixed in 2021r3.

---

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [December 19, 2021, 12:23pm UTC](https://forum.xojo.com/t/search-field-text-encoding/67511/3 "2021-12-19T12:23:51Z")

</div>

[https://documentation.xojo.com/resources/release\_notes/2021r3.html](https://documentation.xojo.com/resources/release_notes/2021r3.html)

[65281](http://feedback.xojo.com/case/65281) Framework » Windows SearchField Text property is now properly encoded as UTF8 on Windows.

---

<div class="post-metadata">

**Author:** ![Peter\_Koren](https://forum.xojo.com/letter_avatar_proxy/v4/letter/p/f14d63/32.png) [@Peter\_Koren](https://forum.xojo.com/u/Peter_Koren)\
**Post date:** [December 19, 2021, 8:33pm UTC](https://forum.xojo.com/t/search-field-text-encoding/67511/4 "2021-12-19T20:33:44Z")

</div>

> [@Lawrence\_Johnson](#):
>
> Before I raise this as a bug, is there a particular reason why the Search Field desktop control appears to be storing it’s contents as a 16-bit (UTF-16) string? I thought Xojo was meant to handle all internal strings in UTF-8?
> 
> I discovered this when I couldn’t work out why my URL query call wasn’t working correctly. Then when I did some debugging I found that the text content of the control was being stored as 16-bits per character. So the phrase “test” for example, was being urlencoded to t%00e%00s%00t%00 and not being understood by the server.
> 
> I’ve swapped back to using an ordinary Text Field control for now as I don’t really need to use the search field but thought I’d raise this in case anyone else has encountered it.
> 
> Tested with Xojo 2021r2.1 on Windows. I have not checked if Mac or Linux have this proble

I had a similar problem before. It is better to use Björn’s SearchControl.
