修改文本文件操作无法查找和替换值



我们有一个 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>

问题是,通过上述操作,当 searchValue 属性中存在重音字符(如"è"(时,它总是无法找到文本。

此更改适用于标准拉丁文本,只有重音字符失败。

我们尝试设置多个"编码"属性值(1252、CP1252、Windows-1252、ISO 8859-1(,但没有任何运气。

文件本身在记事本++中报告为"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 Filestestuserstrings.txt
   Execute action successful after 102 ms

这是我尝试更改的文件:

https://www.dropbox.com/s/j1bq070eznzby01/userstrings.txt?dl=0

安装4j 版本 7.0.9

这是 install4j 中的一个错误,它将在 7.0.11 中修复,请联系 support@ej-technologies.com 以获取已经修复的版本。

顺便说一句,文件的"编码"属性的正确值是"Cp1252"。

最新更新