File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -62,10 +62,18 @@ public Rune (char ch)
6262 }
6363
6464 /// <summary>
65- /// Gets a value indicating whether this <see cref="T:System.Rune"/> contains a valid Unicode codepoint.
65+ /// Gets a value indicating whether this <see cref="T:System.Rune"/> can be encoded as UTF-8
6666 /// </summary>
6767 /// <value><c>true</c> if is valid; otherwise, <c>false</c>.</value>
68- public bool IsValid => value <= MaxRune . value ;
68+ public bool IsValid {
69+ get {
70+ if ( 0 <= value && value <= surrogateMin )
71+ return true ;
72+ if ( surrogateMax < value && value < MaxRune )
73+ return true ;
74+ return false ;
75+ }
76+ }
6977
7078 // Code points in the surrogate range are not valid for UTF-8.
7179 const uint surrogateMin = 0xd800 ;
You can’t perform that action at this time.
0 commit comments