in reply to Unexpected output from my PERL program. WHAT is my problem???
my C program prints out "HELLO--HELLO" with nothing in between
You seem to be implying that print extracted the first 6 characters and the last 6 characters of the string it was given. That's nonsense.
If the string passed to the parent process and therefore print contains nothing between the dashes, it's because $decoded_content is empty, which means the response's body was empty for that request.
You're going to insist the response wasn't empty, that it contained the UTF-16be document discussed elsewhere. And I agree. That means the test you said you ran is different than the one you said you ran. The problem is that you are treating the downloaded file as a NUL terminated string. That's a bug in your C program.
I don't get this if I print a regular string variable that I created, to file.
Good, that means there's nothing messing with your file handles. You are saving what you get.
With that I see it, except it obviously is encoded UTF16BE because of the "@^H@^e@^l@^l@^l@^o" characters I see.
I believe you mean UTF-16be. The case doesn't matter, but you missed the dash.
So the only problem is that you want to extract some data from the file you are downloading. For starters, we need to know in what format is the file you are downloading, and in what encoding do you want the extracted data to be.
Update: Updated response to first quote.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Unexpected output from my PERL program. WHAT is my problem???
by URAvgDeveloper101 (Novice) on Nov 04, 2009 at 16:21 UTC | |
by ikegami (Patriarch) on Nov 04, 2009 at 16:26 UTC | |
by URAvgDeveloper101 (Novice) on Nov 04, 2009 at 16:38 UTC | |
by ikegami (Patriarch) on Nov 04, 2009 at 17:37 UTC | |
by URAvgDeveloper101 (Novice) on Nov 04, 2009 at 17:44 UTC | |
| |
by ikegami (Patriarch) on Nov 04, 2009 at 17:39 UTC |