SQLite Forum

zero width space
Login
> This u200d seems to be a zero width space.

It's a [zero-width joiner][1], actually. [A zero-width space is something else][2].

> convert a unicode entity to an utf-8 character? 

All UTF-8 characters *are* Unicode entities.

Are you perhaps saying you have a literal "u200d" string (5 ASCII characters) in the input and need to turn it into an actual Unicode character, encoded as UTF-8? If so, then presuming the terminal locale is UTF-8:

----

``` shell
$ sqlite3 :memory: "select replace('अमिताभ बच्u200dचन', 'u200d', char(0x200D))"
अमिताभ बच्‍चन
$ !! | od -t c
0000000    अ  **  **   म  **  **   ि  **  **   त  **  **   ा  **  **   भ
0000020   **  **       ब  **  **   च  **  **   ्  **  ** 342 200 215   च
0000040   **  **   न  **  **  \n                                        
0000046
```

----

That "342 200 215" bit is the octal representation of the character 0x200D encoded in UTF-8.

In other words, you might be looking for a combination of [`replace()`][3] and [`char()`][4].

**EDIT:** Shortened example code for clarity. Also, [bang-bang][5]!

[1]: https://en.wikipedia.org/wiki/Zero-width_joiner
[2]: https://en.wikipedia.org/wiki/Zero-width_space
[3]: https://sqlite.org/lang_corefunc.html#replace
[4]: https://sqlite.org/lang_corefunc.html#char
[5]: https://unix.stackexchange.com/a/3748/138