# Automatically add a space before the emoji if the user is typing Chinese and uses emoji picker

**URL:** <https://meta.discourse.org/t/automatically-add-a-space-before-the-emoji-if-the-user-is-typing-chinese-and-uses-emoji-picker/83285>\
**Category:** Feature\
**Created:** [March 19, 2018, 8:24am UTC](https://meta.discourse.org/t/automatically-add-a-space-before-the-emoji-if-the-user-is-typing-chinese-and-uses-emoji-picker/83285 "2018-03-19T08:24:02Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![misaka4e21](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@misaka4e21](https://meta.discourse.org/u/misaka4e21)\
**Post date:** [July 11, 2018, 6:49am UTC](https://meta.discourse.org/t/automatically-add-a-space-before-the-emoji-if-the-user-is-typing-chinese-and-uses-emoji-picker/83285/11 "2018-07-11T06:49:59Z")

</div>

There are two problems:

- (a) If an emoji are chosen from the emoji picker, it will lack for a space before the first colon `:`, not only in Chinese posts, but in English posts as well. Users will get a not rendered a:smile: (`a:smile:`) if they input `a` and then select 😄 (`:smile:`) from the emoji picker.
- (b) A colon `:` after a Latin character won’t cause auto-completion, yet a colon after a CJK Unihan character will. It could be solved exactly by (2).

To solve (a), (3) should be implemented in the emoji picker, not / not just in auto-completion.

(1) and (4) are in different logic.  
To check if a character is in Chinese or not, we could try:

> <https://github.com/zh99998/discourse-username-localization/blob/master/assets/javascripts/discourse/pre-initializers/override-username-match.js.es6#L18>

Though I don’t know whether the regular expression above will provide higher performance.

---

_[View the full topic](https://meta.discourse.org/t/automatically-add-a-space-before-the-emoji-if-the-user-is-typing-chinese-and-uses-emoji-picker/83285)._
