Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 934
  • Last Modified:

InternetCanonicalizeUrl question

I'm trying to post the contents of a text file to a website.  The problem is that when I call InternetCanonicalizeUrl, it removes all the newline characters.  So if the text file looked like:

This is
the text

it gets encoded as

This%20isthe%20text

What is the correct way to post text to a website and keep the newline character intact?
0
lwinkenb
Asked:
lwinkenb
  • 3
  • 2
1 Solution
 
jkrCommented:
>>when I call InternetCanonicalizeUrl, it removes all the newline characters

Newline characters are usually not supposed to be part of an URL - have you tried the 'ICU_NO_ENCODE' flag?
0
 
jkrCommented:
BTW, if that does not work, you might consider using an alternative approach like http://www.codeproject.com/string/urlencode.asp
0
 
lwinkenbAuthor Commented:
I tried ICU_NO_ENCODE already, but it had the same problem.

I took a look at the link, but I'm not using MFC for this project.  I'm considering just replacing the newline characters with <br> and then encoding the string, but I was hoping there was some easier way to do it.
0
 
jkrCommented:
>>I'm not using MFC for this project

The interesting part of the encoding function does not use MFC :o)
0
 
lwinkenbAuthor Commented:
Thanks for the response jkr.  Although it wasnt what I wanted to hear, it is correct :)
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now