UDP API Content Encoding

Want to help out? Need help accessing the AniDB API? This is the place to ask questions.

Moderator: AniDB

Locked
aredhel
Posts: 4
Joined: Sun Aug 21, 2005 7:10 am

UDP API Content Encoding

Post by aredhel »

The API says:
escape scheme for option values: html form encoding + newline
I thought I knew what this meant but on further testing I don't. Would some one explain exactly what this means, and give before and after example strings. Or better yet update the api docs with that info.

-aredhel
exp
Site Admin
Posts: 2438
Joined: Tue Oct 01, 2002 9:42 pm
Location: Nowhere

Post by exp »

basically it means anything a webbrowser would correctly render might happen :P
which means there are multiple ways each character could be represented.
yeah I know, this sucks, but it's a legacy problem.

BYe!
EXP
aredhel
Posts: 4
Joined: Sun Aug 21, 2005 7:10 am

Post by aredhel »

Thank you for getting back to me.

So when getting data back from the udp api 2, you get html fragments with the char '|' stripped. I think I can deal with that.

My main problem right now is how to quote data sent to to the api. In the web interface it's easy to set a field to some unicode chars like : "ミ☆", which comes back from the udp api as:

Code: Select all

"& #12511;& #9734;" //spaces added to keep webbrowsers from rendering as unicode chars.
But I can't for the life of me figure out how to use the udp api to put "ミ☆" into a field.

If it can't be done in udp api v2, the two weeks I spent thinking about how you might have done it have given me some ideas on how to do it in the next version. Where whould be the best place to bring those ideas up?

-Aredhel
PetriW
AniDB Staff
Posts: 1522
Joined: Sat May 24, 2003 2:34 pm

Post by PetriW »

aredhel wrote:But I can't for the life of me figure out how to use the udp api to put "ミ☆" into a field.
Huh? This doesn't make sense...
html encoding is simple "&# unicode number ;", aka your application has to support unicode to use the titles, actually converting them is trivial.
exp
Site Admin
Posts: 2438
Joined: Tue Oct 01, 2002 9:42 pm
Location: Nowhere

Post by exp »

aredhel wrote:If it can't be done in udp api v2, the two weeks I spent thinking about how you might have done it have given me some ideas on how to do it in the next version. Where whould be the best place to bring those ideas up?
not sure what you mean, but this is the place to go for future udp api changes.
http://www.anidb.net/forum/viewtopic.php?t=4466

BYe!
EXP
aredhel
Posts: 4
Joined: Sun Aug 21, 2005 7:10 am

Post by aredhel »

PetriW wrote:
aredhel wrote:But I can't for the life of me figure out how to use the udp api to put "ミ☆" into a field.
Huh? This doesn't make sense...
html encoding is simple "&# unicode number ;", aka your application has to support unicode to use the titles, actually converting them is trivial.
Here is an example of whats happening. please note that ミ☆ are both "&# unicode number ;" it just the forum is not quoting the & properly, and not leting me quote it my self.

Code: Select all

> MYLISTADD lid=8082697&edit=1&storage=fooミ☆&tag=qhvuh&s=a2Lp1
< qhvuh 311 MYLIST ENTRY EDITED
> MYLIST lid=8082697&tag=cthpb&s=a2Lp1
< cthpb 221 MYLIST
8082697|105967|3925|318|0|1123869037|0|0|foo||
Note that the the add was accepted but the storage field was truncated. My guess is this is because & is the field separator. If I had writen the server end of the api it would have returned a "505" because "#12511;" is not a known field nameand is not fallowed by a "=". If there is not a way to escape a "&" char then you can't input unicode chars with this api.

-Aredhel

[EditRar: Escaped as intended]
Rar
AniDB Staff
Posts: 1471
Joined: Fri Mar 12, 2004 2:41 pm
Location: UK
Contact:

Post by Rar »

Really, english/romaji ep titles should be ascii only, feel free to creq out any escaped unicode.

Rar
epoximator
AniDB Staff
Posts: 379
Joined: Sun Nov 07, 2004 11:05 am

Post by epoximator »

this will be fixed in the next version of the server. (the storage field will not be truncated on aredhels example)
Locked