Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / UTF-8 Format

Author
Message
2DD
9
Years of Service
User Offline
Joined: 19th Jul 2014
Location:
Posted: 19th Jul 2014 15:53
Hi

I would like to get HTTP file and set it on the screen.

Is it possible to use UTF-8 on AppGameKit?
If it's possible, please tell me how.

Thank you.
Markus
Valued Member
19
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 20th Jul 2014 11:08
showing web site
OpenBrowser( url )

http commands
GetHTTPFile

what means set in screen?
a pic / a text / or compleate website

UTF-8 is a stupid format with variable byte lenght for a char.
so as I know, strings in agk use single byte each char.
if u put utf8 in a string the thing is how to display correct.

http://www.appgamekit.com/documentation/Reference/HTTP.htm

AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265
2DD
9
Years of Service
User Offline
Joined: 19th Jul 2014
Location:
Posted: 21st Jul 2014 18:29
Thanks for replying.

I want to display the Japanese text which is UTF-8 on the screen.

UTF-8 is major in Japanese website.


I tried this code but characters are corrupted.

Quote: "
MainLoop()
end

function MainLoop()

Response$=GetFromWeb("www.yahoo.co.jp","index.html")

do
Print(Response$)
if getpointerpressed()=1 then exit
Sync()
loop

endfunction

function GetFromWeb(Host$,URLPath$)

Response$=""

if GetInternetState()=1
iHTTP=CreateHTTPConnection()
iSecure=0
szUser$=""
szPass$=""
if SetHTTPHost( iHTTP, Host$, iSecure, szUser$, szPass$ )=1
if SendHTTPRequestASync( iHTTP, URLPath$ )=1
do
ret=GetHTTPResponseReady( iHTTP )
if ret=-1 then exit //Cancel
if ret=1 then exit //Ready
print("wait ...")
sync()
loop
if ret=1
Response$=GetHTTPResponse( iHTTP )
endif
endif //Get
CloseHTTPConnection( iHTTP )
endif //Host
DeleteHTTPConnection( iHTTP )
endif //Internet

endfunction Response$

"



Is there any way to display UTF-8 correctly?
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 22nd Jul 2014 09:10
UTF-8 is not stupid at all. It's the normal standard for the Web because the Unicode character set can be encoded in ASCII without worrying about Little Endian or Big Endian issues.

Good Wiki on this here:

http://en.wikipedia.org/wiki/UTF-8

Game engines like AppGameKit don't render system fonts - they have to use bitmap fonts. This is not trivial for Kanji, which has potentially about 12000 glyphs. Katakana has only 50 plus diacritical marks.

Extracting the Unicode value from the UTF-8 stream would be trivial in AGK. From the 16-bit numbers produced you could tell whether the Unicode page base was Katakana, Hiragana, or Kanji. If you had bitmap fonts, you could then extract the glyph for each character to build your image.

Good luck!

-- Jim - When is there going to be a release?
2DD
9
Years of Service
User Offline
Joined: 19th Jul 2014
Location:
Posted: 23rd Jul 2014 19:44
Thanks a lot.

It is tough but I will try.

Login to post a reply

Server time is: 2024-03-28 15:06:45
Your offset time is: 2024-03-28 15:06:45