Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
When trying to fetch content from a web page, you sometimes want to fetch it in a specific language. This is possible by setting the Accept-Language in the HTTP Header.
However, this doesn't work as you expect. The following code:
let
Source = Web.Page(Web.Contents("http://www.imdb.com/chart/top", [Headers=[#"Accept-Language"="en-US"]])),
Data0 = Source{0}[Data],
#"Changed Type" = Table.TransformColumnTypes(Data0,{{"", type text}, {"Rank & Title", type text}, {"IMDb Rating", type number}, {"Your Rating", type text}, {"2", type text}})
in
#"Changed Type"
Produces these headers (collected with Fiddler):
GET /chart/top HTTP/1.1
Accept: */*
Accept-Language: fi,en-US;q=0.7,en;q=0.3
UA-CPU: AMD64
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.2; Win64; x64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)
Host: www.imdb.com
Connection: Keep-Alive
As you can see, it first language is fi (since my laptop is configured with a Finnish setup). I would expect the header to be only en-US as defined in the Power Query.
The bug is in the Web.Page function, because if I first fetch the content and the parse it then it works. I.e. the code below works fine:
let
SourceAsText = Text.FromBinary(Web.Contents("http://www.imdb.com/chart/top", [Headers=[Accept="html", #"Accept-Language"="en-US"]])),
Source = Web.Page(SourceAsText),
Data0 = Source{0}[Data],
#"Changed Type" = Table.TransformColumnTypes(Data0,{{"", type text}, {"Rank & Title", type text}, {"IMDb Rating", type number}, {"Your Rating", type text}, {"2", type text}})
in
#"Changed Type"
Here is the header, from the http query which now is correct:
GET /chart/top HTTP/1.1
Accept: html
Accept-Language: en-US
User-Agent: Microsoft.Data.Mashup (https://go.microsoft.com/fwlink/?LinkID=304225)
Accept-Encoding: gzip, deflate
Host: www.imdb.com
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.