diff --git a/patches/ruby/marshal_utf8.patch b/patches/ruby/marshal_utf8.patch
new file mode 100644
index 0000000..64e58f0
--- /dev/null
+++ b/patches/ruby/marshal_utf8.patch
@@ -0,0 +1,15 @@
+diff --git a/marshal.c b/marshal.c
+index 4cba05d..dfce6ee 100644
+--- a/marshal.c
++++ b/marshal.c
+@@ -1312,7 +1312,9 @@ r_unique(struct load_arg *arg)
+ static VALUE
+ r_string(struct load_arg *arg)
+ {
+-    return r_bytes(arg);
++    VALUE str = r_bytes(arg);
++    rb_enc_associate(str, rb_utf8_encoding());
++    return str;
+ }
+ 
+ static VALUE
diff --git a/patches/ruby/unused_param.patch b/patches/ruby/unused_param.patch
new file mode 100644
index 0000000..d7f2cb9
--- /dev/null
+++ b/patches/ruby/unused_param.patch
@@ -0,0 +1,25 @@
+diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
+index 0a8407a..22dff42 100644
+--- a/include/ruby/ruby.h
++++ b/include/ruby/ruby.h
+@@ -1207,6 +1207,9 @@ rb_obj_wb_unprotect(VALUE x, const char *filename, int line)
+     RGENGC_LOGGING_WB_UNPROTECT((void *)x, filename, line);
+ #endif
+ 
++	(void) filename;
++	(void) line;
++
+ #if USE_RGENGC
+     /* `x' should be an RVALUE object */
+     if (FL_TEST_RAW((x), FL_WB_PROTECTED)) {
+@@ -1227,6 +1230,10 @@ rb_obj_written(VALUE a, VALUE oldv, VALUE b, const char *filename, int line)
+     RGENGC_LOGGING_OBJ_WRITTEN(a, oldv, b, filename, line);
+ #endif
+ 
++	(void) oldv;
++	(void) filename;
++	(void) line;
++
+ #if USE_RGENGC
+     /* `a' should be an RVALUE object */
+     if (FL_TEST_RAW((a), FL_OLDGEN) &&