File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ Returns whether +self+ is encoded correctly:
2+
3+ s = 'Straße'
4+ s.valid_encoding? # => true
5+ s.encoding # => #<Encoding:UTF-8>
6+ s.force_encoding(Encoding::ASCII).valid_encoding? # => false
7+
8+ Related: see {Querying}[rdoc-ref:String@Querying].
Original file line number Diff line number Diff line change @@ -11469,11 +11469,8 @@ rb_str_b(VALUE str)
1146911469 * call-seq:
1147011470 * valid_encoding? -> true or false
1147111471 *
11472- * Returns +true+ if +self+ is encoded correctly, +false+ otherwise:
11472+ * :include: doc/string/valid_encoding_p.rdoc
1147311473 *
11474- * "\xc2\xa1".force_encoding(Encoding::UTF_8).valid_encoding? # => true
11475- * "\xc2".force_encoding(Encoding::UTF_8).valid_encoding? # => false
11476- * "\x80".force_encoding(Encoding::UTF_8).valid_encoding? # => false
1147711474 */
1147811475
1147911476static VALUE
You can’t perform that action at this time.
0 commit comments