I have a WAM with a Response(#http1) and I'm build a webpage containing UTF8 string (*NVARCHAR)
I'm building the page
#workutf8 := '<html><head>'
...
#workutf8 += #ONXTX8
...
#workutf8 += '</body><html>'
#MyFile.CreateTemporaryFile
#MyFile.WriteAllText Text(#workutf8)
#http1.ContentFile := #MyFile
#http1.ContentType := 'text/html'
#http1.RemoveFile := true
This displays a page of junk (little square boxes lots of letters wth accents etcetera).
If I remove the content type the page is downloaded but readable.
Any ideas about what I'm doing wrong.
I'm getting utf-8 from an external source ad I need to to display it without losing anything which I can't do with WEBEVENT.
If I build the file as above on the iseries as '\home\myfile.html' it displays beautifully in the browser.
Create Webpage with UTF8 content in WAM (RESOLVED)
Re: Create Webpage with UTF8 content in WAM
Addendum to above. If I remove the ContentType lansa creates a file call LANSAWEB (no extension). If I locate the downloaded file in on my PC and add an extension of html and then double click it it opens and displays exactly what I want to see. So I'm very close!
-
caseywhite
- Posts: 192
- Joined: Thu May 26, 2016 1:17 am
Re: Create Webpage with UTF8 content in WAM
You are missing this line to assign the name of the file to be shown to the user.
#http1.AttachmentFileName = 'yourfile.ext'
#http1.AttachmentFileName = 'yourfile.ext'
Re: Create Webpage with UTF8 content in WAM
Thanks for the suggestion but I'm not trying to download a file I'm trying to display web content in the browser.
Re: Create Webpage with UTF8 content in WAM RESOLVED
With help of support I now know that this issue can be resolved by adding
#http1.Charset := 'utf-8'
#http1.Charset := 'utf-8'