|
Weedy Herbst
Too many parameters
Join date: 5 Aug 2004
Posts: 2,255
|
03-29-2008 09:07
I have two issues with one script. First of all, I'm using llHTTPRequest() to fetch a body of data from the web. The problem I have, is parsing the string. I have declared both separator and spacer, but the parsed string is the end of a line and the spacer is the beginning of the next line so therefore the CR/LF is present, which is normally not displayed in UTF-8 charsets. When I pass the string to llSay() or llSetText() is appears fine, but when I pass the string to llSetParcelMusicURL(), it appears with a ? at the end. (presumably this is charset for CR/LF) Obviously, llSetParcelMedia() requires Content-Type text/plain only. It was suggested to me, to shorten the string by llDeleteSubString(llStringLength(),llStringLength()) but I would rather parse the string correctly as opposed to working around it. Secondly, is there a way to declare Content-Type for file extensions other than .txt? A .pls file is a basic text file (UTF-  but http_response returns a "Unsupported or Unknown Content-Type) Does anyone have any insight on these issues?
|
|
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
|
Cr/lf
03-29-2008 10:02
I'm just guessing this and can't even think of a way of testing it but how about... URL = (string)llParseString2List(URL, [llUnescapeURL("%0D"  , llUnescapeURL("%0A"  ], []); ...would that remove any CR's and LF's?
|
|
Weedy Herbst
Too many parameters
Join date: 5 Aug 2004
Posts: 2,255
|
03-29-2008 10:43
From: Pale Spectre I'm just guessing this and can't even think of a way of testing it but how about... URL = (string)llParseString2List(URL, [llUnescapeURL("%0D"  , llUnescapeURL("%0A"  ], []); ...would that remove any CR's and LF's? Thanks for the suggestion Pale. I was avoiding llEscapeURL and llUnescapeURL() because of the 256 character limit, although it might fit in this case. I often wonder why it's limited this way?
|
|
Weedy Herbst
Too many parameters
Join date: 5 Aug 2004
Posts: 2,255
|
03-29-2008 12:29
I used "mediaURL = llGetSubString(toPlay, 0, (llStringLength(toPlay) -2));" to workaround the CR/LF issue.
Which leaves me with the second issue.... Content-Type and the .pls extension. Anyone know how to get http_reponse to handle this?
|
|
Papalopulus Kobolowski
working mind
Join date: 11 Aug 2006
Posts: 326
|
03-29-2008 13:44
Try this post at the end , I use that and work for me setting the parcel media and showing the name station, song name , status etc /54/87/152921/1.html
|