- Powered by Domino 8.5.2 Domino Accelerator Pack
- Cache, Combine, JS-Minify and Compress content
Lotus Triple Search DominoExperts + Blogs + R8 forum -> Script vault -> Lotus Script

 charset problem getting data from the web

mersonimPost date: 2011-03-01 09:04
Hi I'm struggling to read data from a web site which has special character not converted correctly by Notes. In fact, the string is "FORLÌ|2000004708|14/02/2011" but I always get "FORL■2000004708|14/02/2011" here below the script I wrote which also include utf-8 character conversion but it doesn't work. is there anybody who already came across this problem and can give me some help? thanks in advance. mauro Set HTTPBolle=CreateObject("Microsoft.XMLHTTP") '### Leggo il link Web ### annoBolle$=Cstr(Year(Today)) URLServerBolle$ = "http://mysitexxx:8080/" + annoBolle$ + "Bolle/" URLBolle$ = URLServerBolle$ +FileBolleWeb$+"txt" Call"GET",URLBolle$,True) ' Header (doveva esser eun UTF-8 in get ma nn va Call HTTPBolle.SetRequestHeader("Content-Type" , "text/xml;charset=utf-8") Call HTTPBolle.SetRequestHeader("SoapAction", "") Call HTTPBolle.send(Null) '### LEGGO IL FILE DAL LINK WEB ### HTTPBolleTXT$=HTTPBolle.responseText

Fredrik StöckelPost date: 2011-03-01 10:12
Do you know the charset of the site that you are accessing? You might end end up with a conversion problem if the site that you read data from uses a different charset than the charset that you prefer.

mersonimPost date: 2011-03-01 14:08
Hi Fredrik, Thx for your reply. I don't know the charset of the target site. However, if I get data from there by using IE or the Notes Browser the result is correct. I guess the problem is about the call to HTTP by creating an object type Microsoft.XMLHTTP I found people asking in hundreds of forums but unfortunately for me none of them had a solution for Notes developers. What do you think?

DannePost date: 2011-03-01 14:14

You can try and check what charset server is using for the data by using say FireBug in Mozilla.

You need to check the response headers directly as most browsers try and show/convert the data so it is readable in the charset you are using.

This for example is the response header for this thread in firebug.

Response Headersview source

Tue, 01 Mar 2011 13:09:11 GMT
text/html; charset=UTF-8
max-age=0, no-cache, no-store, must-revalidate

Try and check the source you are having problem with and see what the response headers say about the Character set. (install firebug and open the data source you are reading and inspect the call and see what the charset is)

mersonimPost date: 2011-03-02 08:19
Hi Danne, the charset is ISO-8859-1. I have changed my script but still doesn't work. any idea?

Tomas NielsenPost date: 2011-03-04 12:56


What happens if you try to change:

Call HTTPBolle.SetRequestHeader("Content-Type" , "text/xml;charset=utf-8")


Call HTTPBolle.SetRequestHeader("Content-Type" , "text/xml;charset=ISO-8859-1")

Just a thought.

If you could align both sites to use the same encoding you should also get it to work.

RobMPost date: 2013-05-31 19:17
...a couple of years too late to help, but in case anyone else is searching... get the xml from the http object.responseBody. The responseBody attribute will not contain more than 65K (?, but as long as the xml you are receiving is shorter than that you will have the utf-8 characterset. Dim responsebody As Variant On error 171 GoTo long_response 'this allows us to pick up UTF-8 charset but only up to 65k - this is the LS max array size, then you get error 171 responsebody = HTTPBolle.ResponseBody For i = 0 To UBound(responsebody) reply = reply + Chr(responsebody(i)) Next Hope this helps someone...

RSS feed
Subscribe to Forum

Share this page

Top posters
Tomas Nielsen212
Joacim Boive27
Fredrik Stöckel27
Niklas Waller13
Kenneth Haggman11
Bryan Kuhn10
Daniel Lehtihet9
Jonas Israelsson8