Hello friends,
how can I convert a htm file to UTF-8
Thank you in advance
Otto
Otto wrote:Hello friends,
how can I convert a htm file to UTF-8
Thank you in advance
Otto
function saveAsHtml( cDatei )
local oWord
local cTemplate := cDatei
local cHtmlText := ""
local cAppPath := cFilePath( GetModuleFileName( GetInstance( ) ) )
local cSaveAsFile := cAppPath + "Email.htm"
ferase( cSaveAsFile )
oWord := CreateObject( "Word.Application" )
oWord:Documents:Open( cTemplate, 0 )
oWord:Visible := .T.
// save it in HTML format
#define wdFormatHTML 8
oWord:ActiveDocument:SaveAs2( cSaveAsFile, wdFormatHTML )
oWord:ActiveDocument:Close()
oWord:Quit()
cHtmlText := memoread( cSaveAsFile )
cHtmlText := STRTRAN( cHtmlText, "v\:* {behavior:url(#default#VML);}", "" )
cHtmlText := STRTRAN( cHtmlText, "o\:* {behavior:url(#default#VML);}", "" )
cHtmlText := STRTRAN( cHtmlText, "w\:* {behavior:url(#default#VML);}", "" )
cHtmlText := STRTRAN( cHtmlText, ".shape {behavior:url(#default#VML);}", "" )
//? 'src="' + cAppPath
cHtmlText := STRTRAN( cHtmlText, 'src="', 'src="' + cAppPath )
memowrit( cSaveAsFile, cHtmlText )
return NIL
//----------------------------------------------------------------------------//
oWord := CREATEOBJECT( "Word.Application" )
oWord:Visible := .t.
oWord:ChangeFileOpenDirectory ( cDocPfad )
oWord:Documents:Open( cDocName, 0 , 1 )
// 65001 Microsoft.Office.Core.MsoEncoding.msoEncodingUTF8
oWord:WebOptions:Encoding = 65001
#define wdFormatFilteredHTML 10
oWord:ActiveDocument:SaveAs2( "test.htm", wdFormatFilteredHTML )
oWord:ActiveDocument:Close()
oWord := CREATEOBJECT( "Word.Application" )
oWord:Visible := .t.
oWord:ChangeFileOpenDirectory ( cDocPfad )
oWord:Documents:Open( cDocName, 0 , 1 )
oDoc := oWord:ActiveDocument
// 65001 Microsoft.Office.Core.MsoEncoding.msoEncodingUTF8
oDoc:WebOptions:Encoding = 65001
#define wdFormatFilteredHTML 10
oWord:ActiveDocument:SaveAs2( "test.htm", wdFormatFilteredHTML )
oWord:ActiveDocument:Close()
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=Generator content="Microsoft Word 15 (filtered)">
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 37 guests