mirror of
https://github.com/ruby/ruby.git
synced 2026-01-26 20:19:19 +00:00
9 lines
314 B
Plaintext
9 lines
314 B
Plaintext
Returns whether +self+ is encoded correctly:
|
|
|
|
s = 'Straße'
|
|
s.valid_encoding? # => true
|
|
s.encoding # => #<Encoding:UTF-8>
|
|
s.force_encoding(Encoding::ASCII).valid_encoding? # => false
|
|
|
|
Related: see {Querying}[rdoc-ref:String@Querying].
|