Merge pull request #177 from Half-Shot/develop
Fixed default avatars not working with unicode.
This commit is contained in:
commit
d9e58d9626
1 changed files with 5 additions and 3 deletions
|
@ -101,9 +101,11 @@ module.exports = React.createClass({
|
|||
|
||||
_getInitialLetter: function() {
|
||||
var name = this.props.name;
|
||||
var initial = name[0];
|
||||
//For large characters (exceeding 2 bytes), this function will get the correct character.
|
||||
//However, this does NOT get the second character correctly if a large character is before it.
|
||||
var initial = String.fromCodePoint(name.codePointAt(0));
|
||||
if ((initial === '@' || initial === '#') && name[1]) {
|
||||
initial = name[1];
|
||||
initial = String.fromCodePoint(name.codePointAt(1));
|
||||
}
|
||||
return initial.toUpperCase();
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue