From 48652cb41e328e6ad32cb5cb54aefc978df6b11b Mon Sep 17 00:00:00 2001
From: Ash Furrow <ash@ashfurrow.com>
Date: Tue, 25 Apr 2017 17:37:51 +0200
Subject: Fixes string length issue for multibyte characters. (#2443)

---
 app/assets/javascripts/extras.jsx | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'app/assets/javascripts/extras.jsx')

diff --git a/app/assets/javascripts/extras.jsx b/app/assets/javascripts/extras.jsx
index 29c37b9e1..7e3b7a256 100644
--- a/app/assets/javascripts/extras.jsx
+++ b/app/assets/javascripts/extras.jsx
@@ -1,4 +1,5 @@
-import emojify from './components/emoji'
+import emojify from './components/emoji';
+import { length } from 'stringz';
 
 $(() => {
   $.each($('.emojify'), (_, content) => {
@@ -40,9 +41,9 @@ $(() => {
 
   // used on /settings/profile
   $('.account_display_name').on('input', e => {
-    $('.name-counter').text(30 - $(e.target).val().length)
+    $('.name-counter').text(30 - length($(e.target).val()));
   });
   $('.account_note').on('input', e => {
-    $('.note-counter').text(160 - $(e.target).val().length)
+    $('.note-counter').text(160 - length($(e.target).val()));
   });
 });
-- 
cgit 

