Page 1 of 1

Garbled text after using TRVHtmlImporter for Japanese html

Posted: Thu Feb 09, 2006 3:01 pm
by mobipro
Hi there,

I'm using TRVHtmlImporter to import html email from storage, this works well for single bype charsets, but when I try it with some Japanese email it results in garbaled text.

Below is a snippet of my code.

Code: Select all

      if docType='HTML' then begin
        Editor.Clear;
        if XActiveLang = 7 then begin // Language = Japanese
          Importer.ClearDocument := False;
          Importer.DefaultFontName := 'MS PGothic';
          Importer.DefaultCFontName := 'MS PGothic';
          Importer.RichView.Style.DefCodePage := 932;
          Editor.RTFReadProperties.UnicodeMode := rvruOnlyUnicode;
          Editor.ClearUndo;
          ConvertRVToUnicode(Editor.RVData);
          for x := 0 to Importer.RichView.Style.TextStyles.Count -1 do begin
            Importer.RichView.Style.TextStyles[x].Unicode := True;
            Importer.RichView.Style.TextStyles[x].FontName := 'MS PGothic';
            Importer.RichView.Style.TextStyles[x].Charset := SHIFTJIS_CHARSET;
          end;
          ConvertRVToUnicode(Editor.RVData);
          Importer.LoadHtml(strList1.Text);
        end else
          Importer.LoadHtml(strList1.Text);
        Editor.Format;
      end else if docType='RTF'  then begin
Please tell me what I am doing wrong.

Thanks in advance.

Posted: Sun Feb 12, 2006 3:35 pm
by Sergey Tkachenko
Please send me an example of Japanese HTML file causing problems.
(I need to know how DBCS characters are encoded in this HTML)

Sample html

Posted: Mon Feb 13, 2006 3:52 pm
by mobipro
Hi there,

The html can vary as they are coming from email, in the case below it was a plan text email with html wrapped around it and save to disk, sorry I should have mentioned that.

Thanks in advance

Copied from explore:


I send e-mail of Japanese to you.
The contents, such as subject, sender name and body, are sent by attached file.
The subject and sender name will cause garbled characters.

I am looking forward to receiving your mail very soon.

Best Regards

----------Japanese Contents----------

„ª￾k￾†ŠO‚o‚q”Å￾l„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª
￾¡￾¡￾¡
￾¡￾¡￾@￾@￾@￾@￾@￾@￾@ƒrƒWƒlƒX‘I￾‘￾•ƒTƒ}ƒŠ￾[
￾¡
„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª ￾ƒ“ÇŽÒ￾” 48,642•”￾„„ª„ª
￾†ŠO‚o‚q”Å‚Í￾A“ÇŽÒ‚ÌŠF—l‚É‚¨–𗧂¿‚ÆŽv‚í‚ê‚é￾î•ñ‚ð￾A’Ê￾í‚Ì’è
Šú”Å‚Æ‚Í•Ê‚É•s’èŠú‚Å‚¨“Í‚¯‚µ‚Ä‚¢‚é‚à‚Ì‚Å‚·￾B
„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª


￾@„ª„­„ª„­„ª„­„ª„­„ª„­„ª„­„ª„­„ª„­„ª„­„ª„­„ª„­
￾@“]„«￾E„«‚Í„«￾î„«•ñ„«Žû„«￾W„«‚ª„«Œˆ„«‚ß„«Žè„«￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡
￾@„ª„®„ª„®„ª„®„ª„®„ª„®„ª„®„ª„®„ª„®„ª„®„ª„®„ª„®
￾¡￾@￾Ÿ“]￾EƒTƒCƒg￾uƒŠƒNƒiƒr‚m‚d‚w‚s￾v￾Ÿ“]￾E￾î•ñŽ￾￾uƒr￾[ƒCƒ“ƒOŠÖ“Œ”Å￾v
￾¡￾@￾@￾@￾@￾@‚ª˜A“®Šé‰æ‚µ‚½￾AƒIƒXƒXƒ￾‚Ì‹￾￾l￾î•ñ‚ð‚¨‘—‚肵‚Ü‚·￾B
￾¡￾@￾@￾@￾@￾@￾š‚P‚P￾^‚R‚O￾i￾…￾j￾`‚P‚Q￾^‚U￾i‰Î￾j‚Ü‚Å‚ÌŠúŠÔŒÀ’è￾š
￾¡￾@„¬„ª„ª„ª„ª„ª„ª„ª„ª„ª„­„¬„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„­
￾¡￾@„«￾¡‚·‚®“]￾E‚µ‚½‚¢￾l„«„«￾«—ˆ“]￾E‚ð￾l‚¦‚Ä‚¢‚é￾l„«‚Ç‚¿‚ç‚à•KŒ©￾I
￾¡￾@„¯„ª„ª„ª„ª„ª„ª„ª„ª„ª„®„¯„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„®
￾¡„ª„ª„ª„ª￾«￾@￾âƒIƒXƒXƒ￾‚Ì‹￾￾l￾î•ñ‚Í‚±‚¿‚ç￾á￾@￾«„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª
￾¡￾@￾@￾@￾@￾¥–¢ŒoŒ±‚©‚ç￾uƒGƒ“ƒWƒjƒA￾v‚É‚È‚ê‚éŠé‹Æ￾¥
￾¡￾@￾@￾@￾@http://www.recruit.co.jp/BING/BP/PRE0550/FURI/U1.html
￾¡￾@￾@￾@￾@￾¥‹ÆŠE•ÏŠvŠé‹Æ‚ÌŽŸ￾¢‘ナ￾[ƒ_￾[•å￾W￾¥
￾¡￾@￾@￾@￾@http://www.recruit.co.jp/BING/BP/PRE0550/FURI/U2.html
￾¡
￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡￾¡


￾@￾¡￾ „ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª
￾@￾ ￾¡￾@–¢ŒoŒ±‚©‚ç￾uƒGƒ“ƒWƒjƒA￾v‚É‚È‚ê‚éŠé‹Æ
￾@￾¡￾ „ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª„ª


￾@￾`￾u‹Z￾p￾v‚ð￾g‚ɂ‚¯‚é‚Ì‚Í￾A￾¡‚©‚ç‚Å‚à’x‚­‚È‚¢￾I￾`

Code: Select all


<html><body><br><br>I send e-mail of Japanese to you.<br>The contents, such as subject, sender name and body, are sent by attached file.<br>The subject and sender name will cause garbled characters.<br><br>I am looking forward to receiving your mail very soon.<br><br>Best Regards<br><br><br><br>----------Japanese Contents----------<br><br>$B(,!L9f30#P#RHG!M(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(B<br>$B"#"#"#(B<br>$B"#"#!!!!!!!!!!!!!!%S%8%M%9A*=q!u%5%^%j!<(B<br>$B"#(B<br>$B(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(B $B!cFI<T?t(B 48,642$BIt!d(,(,(B<br>$B9f30#P#RHG$O!"FI<T$N3'MM$K$*LrN)$A$H;W$o$l$k>pJs$r!"DL>o$NDj(B<br>$B4|HG$H$OJL$KITDj4|$G$*FO$1$7$F$$$k$b$N$G$9!#(B<br>$B(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(B<br><br><br>$B!!(,(/(,(/(,(/(,(/(,(/(,(/(,(/(,(/(,(/(,(/(,(/(B<br>$B!!E>(-?&(-$O(->p(-Js(-<}(-=8(-$,(-7h(-$a(-<j(-"#"#"#"#"#"#"#"#"#"#"#"#(B<br>$B!!(,(0(,(0(,(0(,(0(,(0(,(0(,(0(,(0(,(0(,(0(,(0(B<br>$B"#!!"!E>?&%5%$%H!V%j%/%J%S#N#E#X#T!W"!E>?&>pJs;o!V%S!<%$%s%04XElHG!W(B<br>$B"#!!!!!!!!!!$,O"F04k2h$7$?!"%*%9%9%a$N5a?M>pJs$r$*Aw$j$7$^$9!#(B<br>$B"#!!!!!!!!!!!z#1#1!?#3#0!J?e!K!A#1#2!?#6!J2P!K$^$G$N4|4V8BDj!z(B<br>$B"#!!(.(,(,(,(,(,(,(,(,(,(/(.(,(,(,(,(,(,(,(,(,(,(,(/(B<br>$B"#!!(-:#$9$0E>?&$7$?$$?M(-(->-MhE>?&$r9M$($F$$$k?M(-$I$A$i$bI,8+!*(B<br>$B"#!!(1(,(,(,(,(,(,(,(,(,(0(1(,(,(,(,(,(,(,(,(,(,(,(0(B<br>$B"#(,(,(,(,"-!!"d%*%9%9%a$N5a?M>pJs$O$3$A$i"c!!"-(,(,(,(,(,(,(,(,(,(,(,(B<br>$B"#!!!!!!!!"'L$7P83$+$i!V%(%s%8%K%"!W$K$J$l$k4k6H"'(B<br>$B"#!!!!!!!!(Bhttp://www.recruit.co.jp/BING/BP/PRE0550/FURI/U1.html<br>$B"#!!!!!!!!"'6H3&JQ3W4k6H$N<!@$Be%j!<%@!<Jg=8"'(B<br>$B"#!!!!!!!!(Bhttp://www.recruit.co.jp/BING/BP/PRE0550/FURI/U2.html<br>$B"#(B<br>$B"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#"#(B<br><br><br>$B!!"#""(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(B<br>$B!!"""#!!L$7P83$+$i!V%(%s%8%K%"!W$K$J$l$k4k6H(B<br>$B!!"#""(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(,(B<br><br><br>$B!!!A!V5;=Q!W$r?H$K$D$1$k$N$O!":#$+$i$G$bCY$/$J$$!*!A(B <br><br>
</body></html>


Posted: Mon Feb 13, 2006 5:57 pm
by Sergey Tkachenko
Sorry, I'm afraid this HTML was damaged when pasted in this forum.
Please send it to me as an attachment to svt@trichview.com