nubbbbbbb-_-bb nubbbbbbb-_-bb - 9 months ago 24
Javascript Question

diamond character(�) appeared after fetch url in google script

newbb got a question about character problem between google and webpage table.

I'm using google sheet and script to get a table from a opened website to google spreadsheet.

the page url is below (um.. I have reputation limit)

At first time I used google spreadsheet function 'importhtml'.

The tables works fine but the language is changed weird.
I've changed google language option but didn't work.

picture of character problem at google sheet

so I trying to get HTML of table in google script by following api fetch example and

I thought this problem comes from charset.. encoding.. or something

so added an option about charset ('euc-kr' from the page HTML source)

//in google apps script
function myFunction() {
var option =
"contentType" : "charset=euc-kr"
var response = UrlFetchApp.fetch("~~~url~~~", option);

And It success to take HTML as text

but the language(same above language) looks like this..

diamond characters

How can I solve this problem..? I need normal text table or HTML text in google sheet or script. without MS excel.


According to the docs you can pass a charset to getContentText:


This should return the characters correctly.