ModifyTextFileAction 无法查找和替换值
ModifyTextFileAction fails to find and replace value
我们有一个 ModifyTextFile 操作:
<action name="Einstellungen anpassen FR" id="59" customizedId="" beanClass="com.install4j.runtime.beans.actions.text.ModifyTextFileAction" enabled="true" commentSet="true" comment="" actionElevationType="elevated" rollbackBarrier="false" rollbackBarrierExitCode="0" multiExec="false" failureStrategy="1" errorMessage="">
<serializedBean>
<java class="java.beans.XMLDecoder">
<object class="com.install4j.runtime.beans.actions.text.ModifyTextFileAction">
<void property="encoding">
<string />
</void>
<void property="files">
<array class="java.io.File" length="1">
<void index="0">
<object class="java.io.File">
<string>userstrings.txt</string>
</object>
</void>
</array>
</void>
<void property="replaceValue">
<string>22357,30,2, "Paramètres_Silent"</string>
</void>
<void property="searchValue">
<string>22357,30,2, "Paramètres"</string>
</void>
</object>
</java>
</serializedBean>
<condition />
</action>
问题是,当搜索值中有重音字符(例如“è”)时,使用上述操作总是找不到文本 属性。
此更改适用于标准拉丁文本,只有重音字符失败。
我们已经尝试设置多个 'encoding' 属性 值(1252、CP1252、Windows-1252、ISO 8859-1),但没有成功。
文件本身在 notepad++ 中报告为 'ANSI',但我们找不到确切的代码页。我们无法更改原始代码页,因为它需要保持原样,因为第三方应用程序会读取它。
有谁知道为什么替换无法替换值,安装日志显示如下:
[INFO] com.install4j.runtime.beans.actions.text.ModifyTextFileAction [ID 59]: Execute action
Property files: [userstrings.txt]
Property replaceValue: 22357,30,2, "Paramètres_Silent"
Property searchValue: 22357,30,2, "Paramètres"
Property escapeForPropertyFile: false
Property failIfNoReplacement: false
Property logReplacement: true
Property rollbackSupported: true
Backing up C:\Program Files\test\userstrings.txt
Execute action successful after 102 ms
这是我要更改的文件:
https://www.dropbox.com/s/j1bq070eznzby01/userstrings.txt?dl=0
Install4j 版本 7.0.9
这是 install4j 中的错误,将在 7.0.11 中修复,请联系 support@ej-technologies.com 获取已修复的版本。
顺便说一句,您文件的 "Encoding" 属性 的正确值为 "Cp1252".
我们有一个 ModifyTextFile 操作:
<action name="Einstellungen anpassen FR" id="59" customizedId="" beanClass="com.install4j.runtime.beans.actions.text.ModifyTextFileAction" enabled="true" commentSet="true" comment="" actionElevationType="elevated" rollbackBarrier="false" rollbackBarrierExitCode="0" multiExec="false" failureStrategy="1" errorMessage="">
<serializedBean>
<java class="java.beans.XMLDecoder">
<object class="com.install4j.runtime.beans.actions.text.ModifyTextFileAction">
<void property="encoding">
<string />
</void>
<void property="files">
<array class="java.io.File" length="1">
<void index="0">
<object class="java.io.File">
<string>userstrings.txt</string>
</object>
</void>
</array>
</void>
<void property="replaceValue">
<string>22357,30,2, "Paramètres_Silent"</string>
</void>
<void property="searchValue">
<string>22357,30,2, "Paramètres"</string>
</void>
</object>
</java>
</serializedBean>
<condition />
</action>
问题是,当搜索值中有重音字符(例如“è”)时,使用上述操作总是找不到文本 属性。
此更改适用于标准拉丁文本,只有重音字符失败。
我们已经尝试设置多个 'encoding' 属性 值(1252、CP1252、Windows-1252、ISO 8859-1),但没有成功。
文件本身在 notepad++ 中报告为 'ANSI',但我们找不到确切的代码页。我们无法更改原始代码页,因为它需要保持原样,因为第三方应用程序会读取它。
有谁知道为什么替换无法替换值,安装日志显示如下:
[INFO] com.install4j.runtime.beans.actions.text.ModifyTextFileAction [ID 59]: Execute action
Property files: [userstrings.txt]
Property replaceValue: 22357,30,2, "Paramètres_Silent"
Property searchValue: 22357,30,2, "Paramètres"
Property escapeForPropertyFile: false
Property failIfNoReplacement: false
Property logReplacement: true
Property rollbackSupported: true
Backing up C:\Program Files\test\userstrings.txt
Execute action successful after 102 ms
这是我要更改的文件:
https://www.dropbox.com/s/j1bq070eznzby01/userstrings.txt?dl=0
Install4j 版本 7.0.9
这是 install4j 中的错误,将在 7.0.11 中修复,请联系 support@ej-technologies.com 获取已修复的版本。
顺便说一句,您文件的 "Encoding" 属性 的正确值为 "Cp1252".