Add UTF-8 sanitation to ActiveRecord::Base#attribute_cast_code

Fixes: CNVS-16236

Test plan:
  - rake spec
  - CNVS-16236 and similiar should be resolved.

Change-Id: I8ca7057d1d17f2ec7352884bdc286b82316a089a
Reviewed-on: https://gerrit.instructure.com/43703
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Brian Finney <bfinney@instructure.com>