MongoDB 4.0 добавит поддержку многодокументных транзакций.
I had explicitly set the $KCODE to make your example work. Also, make sure your source file is actually encoded as UTF-8!
# coding: utf-8
require 'rubygems'
require 'htmlentities'
require 'unicode'
$KCODE = 'UTF-8'
coder = HTMLEntities.new
string = "Scròfina"
puts coder.encode(string, :named)