about summary refs log tree commit diff
path: root/app/assets/javascripts/components/features
diff options
context:
space:
mode:
authorAsh Furrow <ash@ashfurrow.com>2017-04-25 17:37:51 +0200
committerEugen Rochko <eugen@zeonfederated.com>2017-04-25 17:37:51 +0200
commit48652cb41e328e6ad32cb5cb54aefc978df6b11b (patch)
tree08b55e791389687506819800bbb972e7e9134cc6 /app/assets/javascripts/components/features
parentd4f7f11c3c8f4c117394feccca9bbe537f59524d (diff)
Fixes string length issue for multibyte characters. (#2443)
Diffstat (limited to 'app/assets/javascripts/components/features')
-rw-r--r--app/assets/javascripts/components/features/compose/components/character_counter.jsx3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/assets/javascripts/components/features/compose/components/character_counter.jsx b/app/assets/javascripts/components/features/compose/components/character_counter.jsx
index 31d82d4d2..284c51b6d 100644
--- a/app/assets/javascripts/components/features/compose/components/character_counter.jsx
+++ b/app/assets/javascripts/components/features/compose/components/character_counter.jsx
@@ -1,4 +1,5 @@
 import PropTypes from 'prop-types';
+import { length } from 'stringz';
 
 class CharacterCounter extends React.PureComponent {
 
@@ -10,7 +11,7 @@ class CharacterCounter extends React.PureComponent {
   }
 
   render () {
-    const diff = this.props.max - this.props.text.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, "_").length;
+    const diff = this.props.max - length(this.props.text);
 
     return this.checkRemainingText(diff);
   }