# Robot-framework to remove unicode characters from string

**URL:** <https://forum.robotframework.org/t/robot-framework-to-remove-unicode-characters-from-string/5097>\
**Category:** Robot Framework\
**Created:** [22 December 2022 07:39 UTC](https://forum.robotframework.org/t/robot-framework-to-remove-unicode-characters-from-string/5097 "2022-12-22T07:39:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bk-user](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/bk-user/32/1446_2.png) [@bk-user](https://forum.robotframework.org/u/bk-user)\
**Post date:** [22 December 2022 07:39 UTC](https://forum.robotframework.org/t/robot-framework-to-remove-unicode-characters-from-string/5097/1 "2022-12-22T07:39:22Z")

</div>

Hi,

My string is - " Año" and “Presentación” or “Joe$”

I want to remove ~ , ’ and $ from string in robot framework. There may be any uni code or special char in string and I want to remove all those chars from string.

---

<div class="post-metadata">

**Author:** ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)\
**Post date:** [22 December 2022 10:52 UTC](https://forum.robotframework.org/t/robot-framework-to-remove-unicode-characters-from-string/5097/2 "2022-12-22T10:52:29Z")

</div>

Hi @bk-user

The [Unidecode](https://pypi.org/project/Unidecode/) module looks like it will do most of what you want to achieve:

```plaintext
***Settings***
Test Template	Convert Unicode Word

***Test Cases***

ñ	Año
ó	Presentación
$	Joe$
3	kožušček

***Keywords***
Convert Unicode Word
	[Arguments] ${originalword}

	${newword}= Evaluate	unidecode.unidecode("${originalword}") unidecode
	Log	${newword}

```

It didn’t do the $ sign but did the others, so depending how many other cases there are you could use a series of [Replace String](http://robotframework.org/robotframework/latest/libraries/String.html#Replace%20String)’s to handle the remaining few something like:

```plaintext
***Settings***
Library String

Test Template	Convert Unicode Word

***Test Cases***

ñ	Año
ó	Presentación
$	Joe$
3	kožušček
@	$p3c!@l

***Keywords***
Convert Unicode Word
	[Arguments] ${originalword}

	${newword}= Evaluate	unidecode.unidecode("${originalword}") unidecode
	${newword}= Replace String	${newword}	!	i
	${newword}= Replace String	${newword}	@	a
	${newword}= Replace String	${newword}	$	s
	${newword}= Replace String	${newword}	3	e
	Log	${newword}

```

 ![Screen Shot 2022-12-22 at 8.50.53 pm](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/2/203988a798e6b8e01c0b4bd420947a997bbda02a.png)  
 ![Screen Shot 2022-12-22 at 8.51.17 pm](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/f/fb3b8516c7df6057bd88d9e69a53c7a611d2a8f7.png)  
 ![Screen Shot 2022-12-22 at 8.49.34 pm](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/4/44991ddbb8c87f885b4184ee912ab9e2f980f9ff.png)

Hopefully that’s what you need,

Dave.

---

<div class="post-metadata">

**Author:** ![bk-user](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/bk-user/32/1446_2.png) [@bk-user](https://forum.robotframework.org/u/bk-user)\
**Post date:** [22 December 2022 14:37 UTC](https://forum.robotframework.org/t/robot-framework-to-remove-unicode-characters-from-string/5097/3 "2022-12-22T14:37:19Z")

</div>

@damies13 Getting Error -  
FAIL Evaluating expression ‘unidecode.unidecode(“kožušček”)’ failed: ModuleNotFoundError: No module named ‘unidecode’

Library String  
Above library is imported but still getting error

---

<div class="post-metadata">

**Author:** ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)\
**Post date:** [22 December 2022 21:56 UTC](https://forum.robotframework.org/t/robot-framework-to-remove-unicode-characters-from-string/5097/4 "2022-12-22T21:56:59Z")

</div>

Hi @bk-user

The [Unidecode](https://pypi.org/project/Unidecode/) python module is not installed by default, but I gave you the link that includes the install instructions. Like most python modules it’s just a pip install.

Dave.
