Spring'25 のリリース以降、Shift_JIS を暗黙的に Windows-31J で解釈する動作を段階的に廃止します。
これに伴い、各文字が Shift-JIS の範囲で厳密に解釈されるようになるため、一部の機能において Windows-31J の範囲の文字が期待通りに解釈されない可能性があります。
文字のエンコーディングに特別な技術要件がない場合は、UTF-8 をご利用いただくことをご検討ください。
Shift-JIS のエンコーディングを用いる必要がある場合は、各機能毎に後述する解決策をご確認ください。
以下のコードは Windows-31J の範囲にある ① (丸数字)を Shift-JIS でエンコードすることを期待するコードです。
EncodingUtil.urlEncode('①', 'Shift-JIS');
// '?' を表す '%3F' が返るようになります。
これまでは暗黙的に Windows-31J の範囲まで解釈を拡大し、このコードが期待する「%87%40」を返していました。
しかし、Spring'25 リリース以降は段階的に厳密な Shift-JIS として解釈されるようになるため、範囲にない文字は '?' 等の代替文字として解釈されるようになります。
また、同じ理由で以下のように Windows-31J 範囲の文字を Shift-JIS でデコードすることを期待するコードにも影響します。
EncodingUtil.urlDecode('%87%40', 'Shift-JIS');
// 文字化けした文字が返るようになります。
丸数字の ① は Shift-JIS の範囲にないため、デコード時に文字化けが発生します。
解決策として、EncodingUtil クラスの各メソッドでは、以下のように引数 encodingScheme で Shift-JIS に代わり Windows-31J を指定してください。
EncodingUtil.urlEncode('①', 'Windows-31J');
EncodingUtil.urlDecode('%87%40', 'Windows-31J');
以下のソースコードは contentType 属性に text/csv;charset=Shift-JIS を指定し、Shif-JIS エンコーディングの CSV がダウンロードされることを期待するソースコードです。
<apex:page contentType="text/csv;charset=Shift-JIS">
①,②,③,④,⑤,⑥,⑦,⑧,⑨
</apex:page>
これまでは暗黙的に Windows-31J の範囲まで解釈を拡大し、このソースコードが期待する「①,②,③,④,⑤,⑥,⑦,⑧,⑨」を返していました。
しかし、Spring'25 リリース以降は段階的に厳密な Shift-JIS として解釈されるようになるため、範囲にない文字は '?' 等の代替文字として解釈されるようになります。
解決策として、Visualforce apex:page の contentType 属性では、以下のように charset=Windows-31J を指定してください。
<apex:page contentType="text/csv;charset=Windows-31J">
①,②,③,④,⑤,⑥,⑦,⑧,⑨
</apex:page>
別途記事をご用意しておりますため、影響と解決策については 外部サービスにおける Shift-JIS 文字セットに対する変更の影響について をご参照ください。
Spring’25 まではレポートエクスポートで指定できる日本語(Shift-JIS)は、暗黙的に Windows-31J として扱われていました。その結果、日本語(Shift-JIS)を指定しエクスポートを実施した場合、Shift-JIS でサポートされていない文字列もWindows-31J でサポートされている文字列に関しては、文字化けが発生しない動作でした。
しかしながら本変更に伴い、Shift-JIS にてサポートされていない文字列がレポート上に含まれている場合、日本語(Shift-JIS)にてエクスポートすると文字化けが発生します。
解決策としてレポートエクスポートにて文字化けが発生する際は、Windows-31J に相当する日本語 (Windows)をご利用ください。
Spring’25 まではウィークリーエクスポートで指定できる日本語(Shift-JIS)は、暗黙的に Windows-31J として扱われていました。その結果、日本語(Shift-JIS)を指定しエクスポートを実施した場合、Shift-JIS でサポートされていない文字列もWindows-31J でサポートされている文字列に関しては、文字化けが発生しない動作でした。
しかしながら本変更に伴い、Shift-JIS にてサポートされていない文字列がエクスポート対象に含まれている場合、日本語(Shift-JIS)にてエクスポートすると文字化けが発生します。
解決策としてウィークリーエクスポートにて文字化けが発生する際は、Windows-31J に相当する日本語 (Windows)をご利用ください。
004464362

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.