As the name suggests, this is a plugin that provides a mojibake (garbled text) function.
However, depending on the environment, the processing might become a bit heavy.
[Updated 20250706] Version 2.0 is now available.
[Updated 20250706] Along with version 2.0, I have also created a Builder version (usable with components). This one is paid.
1. Plugin Overview & Mojibake Mechanism and Precautions to Understand in Advance

Provides a mojibake function.
[Updated 20250706]
It is compatible with V525 and Builder V203, 204.
It is compatible with V525, 600 and Builder V203, 204, 300.
Roughly speaking, you can do the following.
Garble an arbitrary string and embed it (p_mojibake_emb tag)
Garble an arbitrary string and embed it into an arbitrary variable (p_mojibake_make tag)
Specify characters to be displayed as normal text or character names to be displayed, and garble them for display and in the log (p_mojibake_switch tag, p_mojibake_end tag)
Garble an arbitrary string and add it to the backlog (p_mojibake_push_log tag)
Mojibake occurs when there is a character code when the string was originally generated and the character code when displaying it are mismatched.
Character codes are the "code rule systems" for displaying characters on terminals such as PCs.
And the original form of characters displayed on terminals such as PCs is, just as "A1" represents "Column A, Row 1" in Excel or Google Sheets, a code representing coordinates in the target character code table, and the terminal interprets it and displays the character located at those coordinates from the corresponding code table.
[Updated 20250706]
There are multiple character codes, but the character codes that can be handled by this plugin are Shift-JIS (sjis), UTF8 (utf8), and EUC (euc).
There are multiple character codes, but the character codes that can be handled by this plugin for encoding (as a standard before mojibake) are Shift-JIS (sjis), UTF8 (utf8), and EUC (euc).
From Ver2.0, I added hexadecimal (hex), binary (binary), base64 (base64), and URL encoding (url) only for decoding (display after mojibake), but conversely, these are not used as normal character codes.
Now, the mechanism of "Mojibake occurrence" is caused by two conditions: "different code boundaries" and "different characters located at the specified coordinates between character codes," which occur when the coordinate information of the initially transmitted target character code table is interpreted and referenced using a different character code.
Furthermore, "encoding to the target character code" usually refers to "converting input characters, etc., into the code of the target character code", and "decoding the target character code" means "interpreting a coded string by applying it to the character code table of the target character code and displaying it as characters".
Therefore, Mojibake will not occur unless the encode and decode parameters of each tag in this plugin are set to different values.
Note that the initial values for encode and decode in each tag are "utf8" and "sjis" respectively because the most common type of Mojibake seen in Japan is "Mojibake caused by interpreting UTF8 as Shift-JIS".
[Updated 20250706]
Also, since character codes have evolved alongside personal computers, among the three character code systems of Shift-JIS (sjis), UTF8 (utf8), and EUC (euc), Mojibake does not occur for half-width alphanumeric characters and some half-width symbols because they are basically assigned to the same coordinates in every code system.
Therefore, if you want to intentionally cause Mojibake including alphanumeric characters by using these three types of character codes for decoding, please use full-width characters.
[Updated 20250706]
As a note of caution, the number of characters after Mojibake may be greater than the number of characters when interpreted with the original character code ( especially with binary).
Therefore, when using this plugin depending on conditions, and if you are delicately adjusting character breaks such as with line breaks, we recommend that you always check the state before and after Mojibake.
2. Related processes and considered plugins (some require compatibility)
① Existing processes being rewritten The following existing processes are rewritten according to the version.
By the way, since it is automatically determined internally, I have not created variations.
Also, when rewriting, instead of "rewriting everything," I go through the procedure of converting the target function to a string -> adding Mojibake processing by replacing based on the marker pre/post processing -> re-storing it as the target function, so I think it can handle version fluctuations and unexpected plugins where the functions being modified conflict to some extent (in other words, if the process changes completely, it's game over).
-
[Updated 20250706] V525, 600, Builder V300
tyrano.plugin.kag.tag.text.showMessage
tyrano.plugin.kag.tag.text.buildMessageHTML
tyrano.plugin.kag.tag.chara_ptext.start
-
Builder V203, V204
tyrano.plugin.kag.tag.text.showMessage
tyrano.plugin.kag.tag.chara_ptext.start
The following plugins have been considered.
Therefore, please ensure you load this plugin after these plugins..
Neko-sama's Custom Ruby Plugin
Ogihara-sama's "Popopo Sound Plugin"
However, for V525, it is assumed that you will implement the response by referring to the following.
↓ It is fine even if this modification is included.
hororo-sama's "Backlog Plugin"
For version 3.60, which supports V520 and later, the following action is required:
Comment out "const _ex = ; //Temporary function storage?" in backlog.js inside the backlog plugin folder -> Add the following process before "(function () " at the beginning of the same file.
if(_ex==undefined) var _ex = ; //関数一時保存用?
My own pushlog extension plugin
Well, I only use it if it's there when storing garbled text.
3. How to apply the plugin & tags and parameters that become available
① How to applyAs with normal plugins, place the p_mojibake folder in project folder > data > others > plugin, and use "[plugin name="p_mojibake"]" at the same timing as loading other plugins, such as at the beginning of first.ks or title.ks.
However, this time, I have made it possible to pass the following two parameters when loading this plugin.
startesc: List the first characters of the string to be garbled that you do not want to be garbled, separated by commas (you can set whether to actually reflect this in the garbling process with the parameters of each tag). The initial value is "〈,[,「,『,【, ,《".
endesc: List the last characters of the string to be garbled that you do not want to be garbled, separated by commas (you can set whether to actually reflect this in the garbling process with the parameters of each tag). The initial value is "〉,],」,』,】, ,》".
In other words, if you want to add full-width double quotation marks to the initial value, please load it like this: [plugin name="p_mojibake" startesc=",[,「,『,【, ,《,“" endesc=",[,「,『,【, ,《,”" ].
These parameters are when the escflg parameter used in each tag is true, if the first character of the target string to be garbled matches any of the comma-separated values passed to startesc, and the last character matches any of the comma-separated values passed to endesc, the corresponding characters at those positions will not be garbled.
In other words, with the initial values, when garbling strings like "「Test」" or "〈Test〉", if the escflg parameter is true, it will be "「Garbled」", "〈Garbled〉", and if false, it will be "Garbled", "Garbled" (as garbled text).
However, in cases like "「Test in 'Test'」", even if the escflg parameter is true, the "'Test'" in the sentence will be garbled.
It is only effective at the very beginning and end of the string.
When this tag is executed, you can display part of the displayed text as garbled text, similar to the emb tag.
The parameters are as follows.
text: Target string to be garbled Required
encode: Encoding for garbled text. Please pass one of the three types: utf8, sjis, or euc as a string. If it is the same as decode, it will not be garbled. The initial value is utf8.
decode: Decoding for garbled text.[Updated 20250706] Pass one of the seven types: utf8/sjis/euc/hex/binary/base64/url as a string. If it is the same as encode, the text will not be garbled. The default value is sjis.
escflg: Escape flag. If this parameter is true, and the first character of the text parameter matches one of the startesc characters defined when the plugin was loaded, and the last character matches one of the endesc characters, the corresponding text will not be garbled. The default value is true.
Usage examples look like this.
ここを→[p_mojibake_emb text="「文字化け」" encode="utf8" decode="euc" escflg=true]するよ!
Executing this tag allows you to store the passed string in a garbled state into any variable specified in the parameters.
The parameters are as follows.
text: The string to be garbled Required
var: Any variable to store the result in *Required
encode: Encoding for garbled text. Pass one of the three types: utf8, sjis, or euc as a string. If it is the same as decode, the text will not be garbled. The default value is utf8.
decode: Decoding for garbled text.[Updated 20250706] Pass one of the seven types: utf8/sjis/euc/hex/binary/base64/url as a string. If it is the same as encode, the text will not be garbled. The default value is sjis.
escflg: Escape flag. If this parameter is true, and the first character of the text parameter matches one of the startesc characters defined when the plugin was loaded, and the last character matches one of the endesc characters, the corresponding text will not be garbled. The default value is true.
Usage examples look like this (after execution, the garbled result of 'mojibake saseru' will be stored in f.mojibake)
[p_mojibake_emb text="文字化けさせます" var="f.mojibake"] 文字化け後→[emb exp="f.mojibake"]
Executing this tag will garble the content displayed on the screen and the content stored in the backlog according to the parameters.
The parameters are as follows.
log: Whether to garble the content stored in the log. true to garble, false to not. The default value is false.
log_charaname: Whether to garble the character name in the log. true to garble, false to not. The default value is false. *To make this effective, it must be executed before the #character name of the character you want to garble.
show_text: Whether to garble the text displayed on the screen. true to garble, false to not. The default value is false.
show_charaname: Whether to garble the character name displayed on the screen. true to garble, false to not. The default value is false. *To make this effective, it must be executed before the #character name of the character you want to garble.
text_encode: Encoding for garbled display text & log text. Pass one of the three types: utf8, sjis, or euc as a string. If it is the same as text_decode, the text will not be garbled. The default value is utf8.
text_decode: Decoding for garbled display text & log text.[Updated 20250706] Pass one of the seven types: utf8/sjis/euc/hex/binary/base64/url as a string. If it is the same as text_encode, the text will not be garbled. The default value is sjis.
chara_encode: Encoding for garbled display character name & log character name. Pass one of the three types: utf8, sjis, or euc as a string. If it is the same as chara_decode, the text will not be garbled. The default value is utf8.
chara_decode: Decodes garbled text for displayed character names and log character names. [Updated 20250706] Pass one of the seven types: utf8/sjis/euc/hex/binary/base64/url as a string. If set to the same as chara_encode, the text will not be garbled. The default value is sjis.
escflg: Escape flag. If this parameter is true, and the first character of the text parameter matches any of the startesc characters defined when the plugin was loaded, and the last character matches any of the endesc characters, the corresponding text will not be garbled. The default value is true.
Usage examples are as follows
[p_mojibake_switch log=false show_text=true show_charaname=false log_charaname=false] あかね 「ログでは文字化けしないよ!」 [p_mojibake_switch log=true show_text=false show_charaname=false log_charaname=true] あかね 「ログでは名前も含めて文字化けしてるよ!」
Instantly sets log, show_text, show_charaname, and log_charaname of the p_mojibake_switch tag to false, preventing any text from being garbled. No parameters.
⑥ [p_mojibake_push_log] tag Allows you to add an arbitrary string to the log with an arbitrary character name, while garbling it.
The parameters are as follows
log_text: The string to add to the log. Required
charaname: The character name for the added log. Default is an empty string.
textflg: Whether to garble the log_text parameter (true) or not (false). Default is false.
charaflg: Whether to garble the charaname parameter (true) or not (false). Default is false.
text_encode: Encoding for garbling the log_text parameter. Pass one of the three types: utf8, sjis, or euc as a string. If set to the same as text_decode, the text will not be garbled. The default value is utf8.
text_decode: Decoding for garbling the log_text parameter. [Updated 20250706] Pass one of the seven types: utf8/sjis/euc/hex/binary/base64/url as a string. If set to the same as text_encode, the text will not be garbled. The default value is sjis.
chara_encode: Encoding for garbling the charaname parameter. Pass one of the three types: utf8, sjis, or euc as a string. If set to the same as chara_decode, the text will not be garbled. The default value is utf8.
chara_decode: Decoding for garbling the charaname parameter. [Updated 20250706] Pass one of the seven types: utf8/sjis/euc/hex/binary/base64/url as a string. If set to the same as chara_encode, the text will not be garbled. The default value is sjis.
escflg: Escape flag. If this parameter is true, and the first character of the text parameter matches any of the startesc characters defined when the plugin was loaded, and the last character matches any of the endesc characters, the corresponding text will not be garbled. The default value is true.
4. Notes
In particular, the following may be mistaken for bugs, but they are specifications based on the mechanism of character codes, so they are not bugs.
Due to character code specifications, half-width alphanumeric characters and some half-width symbols may not be garbled [Updated 20250706] (especially when decoding is utf8/sjis/euc). Since this is an issue with the garbling mechanism and character code specifications, it is not a bug. Please use full-width characters.
If the encode parameter and decode parameter specified for the garbling target in each tag's parameters are the same, the text will not be garbled. This is not a bug, as the garbling mechanism relies on "performing decoding with a character code different from the encoded character code."
Also, when using the [p_mojibake_switch] tag to garble the displayed character name, it is more reliable to write the tag before the "#Character Name" of that character's dialogue.
Wishing you a great time with log-based performance and garbled text.