The Rust version does a type coercion from Ruby VALUE to Rust String. The type coercions are defined generically using Rust traits (see the Helix README) so once somebody defines RubyString -&gt; String once everyone benefits.<p>In this case, the coercion needs to ask Ruby for the encoding tag and ask Ruby to validate the encoding (which is does often enough that it&#x27;s often cached) but after that we can safely coerce directly into a UTF8 string.<p>If we wanted to support other encodings, we could fall back to using Ruby&#x27;s transcoding support (string.encode(&quot;UTF8&quot;)) and again, once someone does the work once it&#x27;ll work for all helix users.