Skip to content

Instantly share code, notes, and snippets.

@SpiceMan
Created November 8, 2019 08:52
Show Gist options
  • Save SpiceMan/74f9cb36c42e0d86a2685d368b74ac90 to your computer and use it in GitHub Desktop.
Save SpiceMan/74f9cb36c42e0d86a2685d368b74ac90 to your computer and use it in GitHub Desktop.
diff --git a/lib/MBPY/DB/Result/Option.pm b/lib/MBPY/DB/Result/Option.pm
index b3bb2d3..a766e0a 100644
--- a/lib/MBPY/DB/Result/Option.pm
+++ b/lib/MBPY/DB/Result/Option.pm
@@ -157,7 +157,11 @@ sub short_name {
my $name = decode( "sjis", $self->name );
$name =~ s/を選んで.+$//;
- return to_sjis($name);
+# 波ダッシュと全角マイナスのUTF-8=>シフトジス変換問題対策
+# 参照:http://blog.livedoor.jp/sasata299/archives/51186273.html
+ $name =~ tr/\x{ff5e}\x{ff0d}/\x{301c}\x{2212}/;
+
+ return encode("sjis", $name);
# return length $name > 8 ? to_sjis(substr($name, 0, 8) ). to_sjis("・・・") : $self->name;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment