From: Joseph Jones Date: 2015-12-17T21:12:53-07:00 Subject: [ruby-core:72322] [Ruby trunk - Feature #11814] [Open] String#valid_encoding? without force_encoding --567387c5_68ebc550_16c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Joseph Jones liked your message with Boxer. On December 13, 2015 at 05:39= :36 MST, usa=40garbagecollect.jp wrote:Issue =2311814 has been reported b= y Usaku NAKAMURA.----------------------------------------=46eature =23118= 14: String=23valid=5Fencoding=3F without force=5Fencodinghttps://bugs.rub= y-lang.org/issues/11814* Author: Usaku NAKAMURA* Status: Open* Priority: = Normal* Assignee: ----------------------------------------Now we have to = set a encoding to a string to validate it, just like:=60=60=60rubystr.for= ce=5Fencoding('euc-jp').valid=5Fencoding=3F =23 =3D> true or false=60=60=60= But to modify the string is not so smart.knu-san requires the way to vali= date a string without modifiing it =5B*1=5D.Then, I propose to add an opt= ional encoding parameter to =60String=23valid=5Fencoding=3F=60.=60=60=60r= ubystr.valid=5Fencoding=3F('euc-jp') =23 =3D> true or false=60=60=60A pat= ch is attached.=5B*1=5D https://twitter.com/knu/status/676009662655934465= (in Japanese)---=46iles--------------------------------valid=5Fencoding.= patch (4.4 KB)-- https://bugs.ruby-lang.org/ --567387c5_68ebc550_16c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Joseph Jones liked your message with Boxer.


= On December 13, 2015 at 05:39:36 MST, usa=40garbagecollect.jp wrote:
=
Issue =2311814 has been re= ported by Usaku NAKAMURA.

------------------------------------= ----
=46eature =2311814: String=23valid=5Fencoding=3F without force=5F= encoding
https://bugs.ruby-lang.org/issues/11814

* Author= : Usaku NAKAMURA
* Status: Open
* Priority: Normal
* Assig= nee:
----------------------------------------
Now we have to s= et a encoding to a string to validate it, just like:

=60=60=60= ruby
str.force=5Fencoding('euc-jp').valid=5Fencoding=3F =23 =3D> tr= ue or false
=60=60=60

But to modify the string is not so = smart.
knu-san requires the way to validate a string without modifii= ng it =5B*1=5D.

Then, I propose to add an optional encoding pa= rameter to =60String=23valid=5Fencoding=3F=60.

=60=60=60rubystr.valid=5Fencoding=3F('euc-jp') =23 =3D> true or false
=60=60= =60

A patch is attached.

=5B*1=5D https://twitter.c= om/knu/status/676009662655934465 (in Japanese)

---=46iles-----= ---------------------------
valid=5Fencoding.patch (4.4 KB)

--
https://bugs.ruby-lang.org/
--567387c5_68ebc550_16c--