Dear author,
I am using RJ texted to open a text file which was created by notepad++ and saved as utf8,
but it is wrong detect as 简体中文gb2312, which cannot be read.
Not all the files are wrong but some of them.
I could manually change the encoding while opening the file but not convinient.
while this file is detect and read correctly by notepad++.
RJ version: 15.50
os: Windows 10 professional
thanks and best wishes!
Solved: Wrong encoding detect in opening chinese utf8 text files
-
- Posts: 3
- Joined: 12 May 2022 04:30
Solved: Wrong encoding detect in opening chinese utf8 text files
Last edited by richiezhong on 20 May 2022 10:56, edited 1 time in total.
Re: Wrong encoding detect in opening chinese utf8 text files
Certainly, there is something off with encoding detection; for some reason when opening a file with the code below
RJ TE shows this dialog window:
Interestingly, the same code but without first two lines, i.e. without
makes even more confusion in encoding detection module:
Yes, this code is pure ASCII. Środkowoeuropejski is Windows-1250, while Zachodnioeuropejski is Windows-1252.
Code: Select all
<?php
ptb_vardump('$customXML');
ptb_vardump('$custom'); // string
echo '<ul>', "\n";
foreach ($customXML->modules->item as $item) {
if (!isset($item['href'])) {
echo '<li>', $item['name'];
echo '<ul>', "\n";
foreach ($item->item as $subitem) {
echo '<li><a href="/admin', $subitem['href'], '">', $subitem['title'], '</a></li>';
}
echo '</ul></li>', "\n";
}
else {
echo '<li><a href="/admin', $item['href'], '">', $item['title'], '</a></li>';
}
}
echo '</ul>', "\n";
Interestingly, the same code but without first two lines, i.e. without
Code: Select all
ptb_vardump('$customXML');
ptb_vardump('$custom'); // string
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus
- Rickard Johansson
- Site Admin
- Posts: 6637
- Joined: 19 Jul 2006 14:29
Re: Wrong encoding detect in opening chinese utf8 text files
The option to "Detect All (encoding and code page) is not always accurate. It uses IMultiLanguage2 interface to detect the code page.
It is recommended to turn this off, unless you really need it. Setting a default encoding in options may help a little...
It is recommended to turn this off, unless you really need it. Setting a default encoding in options may help a little...
Re: Wrong encoding detect in opening chinese utf8 text files
I turned it off and it helped; thank you! (I had default encoding set, btw.)Rickard Johansson wrote: ↑15 May 2022 14:38 It is recommended to turn this off, unless you really need it. Setting a default encoding in options may help a little...
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus
-
- Posts: 3
- Joined: 12 May 2022 04:30
Re: Wrong encoding detect in opening chinese utf8 text files
set Detect All (encoding and code page) to on solved this problem. Thank you very much!Rickard Johansson wrote: ↑15 May 2022 14:38 The option to "Detect All (encoding and code page) is not always accurate. It uses IMultiLanguage2 interface to detect the code page.
It is recommended to turn this off, unless you really need it. Setting a default encoding in options may help a little...
勾上“检测所有(编码和字码页)”,解决问题了,非常感谢!