English > Development

Character encoding for script

(1/2) > >>

firefox:
Hello,
Many thanks for the great program.
I've started to write an import script for japanese site (EUC-JP encoding) and I've noticed a strange thing.
I cannot use japanese character in PosFrom.
Os: Windows 8, PVD 1.0.2.6, the script file saved with encoding utf-8.

--- Code: ---  StartPos := Pos('<table border="0" cellpadding="2" cellspacing="0" class="mg-b20">', HTML);
  StartPos := PosFrom('">レーベル:</td>', HTML, StartPos);
    Cast := Trim(TextBetween(HTML, '>', '<', False, StartPos));
  if Cast <> '----' then
  begin
    CastURL := BASE_URL + Trim(TextBetween(HTML, 'href="', '"', False, StartPos));
    Cast := Trim(TextBetween(HTML, '">', '<', False, StartPos));
    LogMessage('writer: '+ Cast +', url: '+ CastURL);
    AddMoviePerson(Cast, '', '', CastURL, 2);
  end else
    LogMessage('writer not found');

--- End code ---

nostra:
Make sure to provide a correct code page in GetCodePage function

--- Code: ---function GetCodePage : Cardinal;
begin
 Result := CODE_PAGE;
end;
--- End code ---

firefox:
I provided a code page in GetCodePage function (EUC-JP 20932).
You can search with keyword 'mgod0112' with attached script file.
I use writer item for film series info. The writer item didn't show after running the script.
Thank you for your help!

nostra:
There seem to be multiple problems (the program was never tested with such languages):
1. There is a problem when passing data to the script. I will fix it in next update
2. The pascal script compiler does not accept non ANSI characters. This can't be fixed, unless the pascal script compiler is updated. As a workaround you could try saving values in japanese in a file and load them in runtime. (but the first problem must be fixed for this to work)

firefox:

--- Quote from: nostra on October 22, 2013, 06:42:38 pm ---There seem to be multiple problems (the program was never tested with such languages):
1. There is a problem when passing data to the script. I will fix it in next update
2. The pascal script compiler does not accept non ANSI characters. This can't be fixed, unless the pascal script compiler is updated. As a workaround you could try saving values in japanese in a file and load them in runtime. (but the first problem must be fixed for this to work)

--- End quote ---
Please give me an example code for saving japanese values in a file and load them in runtime.
Many thanks for your help and PVD v1.0.2.7!

Navigation

[0] Message Index

[#] Next page

Go to full version