|
Psistorm Ikura
Registered User
Join date: 19 Jul 2006
Posts: 52
|
03-02-2009 07:26
Ive recently run into yet another rather annoying problem. For my project, I want to store encrypted prim data in a notecard, and make a linebreak every 250 characters, then later on, when reading the notecard, reassemble the data into a string. this works so far, but theres an issue that gives me trouble recently.
the initial list of data inside the script at compile time has linebreaks in it. I figured I could simply remove them (tried parsing the entire thing into a list with "\n" as separator, and various other methods, didnt work), but the linebreaks insisted on staying in there, no matter what. I even tried llEscapeURL() to filter out for %A0 - but where newlines should be, %A0 doesnt show up! - yet, in the final output (Im having the data emailed to me, since its more than 1024 characters and I dont want text spam), there are erratic newlines again. its like they arent there, but then again are kind of, in a way.
now my question is: for a string that was entered with newlines into an SL script, how can I reliably remove newlines from it, so I can place them at specific places instead?
I could simply just insert a newline every 250 characters, but this means that, ideally, some lines are 250 characters long, whilst others are 50 characters, then 100 etc, because of the newlines still in there
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
03-02-2009 08:20
IIRC the email parsing automatically inserts it's own newlines. could be that they are removed and you're just seeing that.
to test if your super-string actually has them removed, why not just check the string length? it should drop when they're removed.
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
03-02-2009 10:00
Maybe it could have to do with the suggested 78-character maximum line length in plain text e-mails. I have not idea what LL has done there. See http://tools.ietf.org/html/rfc2822
|
|
Psistorm Ikura
Registered User
Join date: 19 Jul 2006
Posts: 52
|
03-02-2009 10:24
hmm I do definitely get lines past 78 characters though. my longest lines are exactly 250 characters, as was intended, but most of them are shorter (which A: would be a waste of notecard lines, and B: Im worried about having newlines adding up constantly through repeated saving/loading, cluttering up the actual data) it also makes NO difference whether I remove any newlines in the compiled string by hand or leave them there. my only assumption right now is that the encryption magically creates newline characters, which also wouldnt quite make sense edit: I just noticed, it does seem like my email program seems to be the culprit. it adds a linebreak whenever the string gets too long and a suitable character is found, like a / or +. so now Im testing if the text copy/pastes correctly into an SL notecard and i should be just fine 
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
03-02-2009 10:29
Huh. Well, could be. Comb carefully through the specs and implementation (if applicable) of the encryption you are using if you aren't comfortable discussing details here. Perhaps also consider use of something like llStringToBase64() on the encryption result if you need to ensure there are no control characters or whatever.
|
|
Psistorm Ikura
Registered User
Join date: 19 Jul 2006
Posts: 52
|
03-02-2009 10:43
problem solved: it WAS the email client. if there was a line up to 250 characters without a non A-Z 0-9 character, itd be displayed fully. if there was a different character in there, itd add a visual linebreak to the text.
when I copypaste it into a notecard however, all lines are as long as they should be, with newlines in the correct spots and no superficial newlines in there.
its always the same, the problem is /never/ what you think it is XP - thanks for the input everyone though!
|
|
Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
|
03-02-2009 12:22
A Line break is 0x0A, not 0xA0. And you may need to check for a carriage return too, which is 0x0D. That will depend on your operating system and what software you use.
|