method
valid_encoding?
v1_9_3_392 -
Show latest stable
- Class:
String
valid_encoding?()public
Returns true for a string which encoded correctly.
"\xc2\xa1".force_encoding("UTF-8").valid_encoding? #=> true "\xc2".force_encoding("UTF-8").valid_encoding? #=> false "\x80".force_encoding("UTF-8").valid_encoding? #=> false