0
$\begingroup$

When I was trying to join a URL with a parameter and execute it with URLFetch, something unexpected happened.

Here is the code (The URL below doesn't exist and is just for illustration.)

Case 1 (Good):

"http://www.google.com/analysis/key=" <> "12345"

will give "http://www.google.com/analysis/key=12345"

Case 2 (Weird):

"http://www.google.com/analysis/key=" <> "12345678910111213141516171819202122"

will give "http://www.google.com/analysis/key=\ 12345678910111213141516171819202122"

Note that the \ is shown when copying it out. And I think that's the reason the URLFetch fails.

So how can I fix this?

$\endgroup$
2
  • 5
    $\begingroup$ You probably want: SetOptions[$FrontEndSession, "ExportTypesetOptions" -> {"PageWidth" -> Infinity}]. This has been discussed in e.g. Setting output width for CopyToClipboard, of which this question is a likely duplicate. $\endgroup$ Commented Mar 9, 2016 at 16:28
  • $\begingroup$ Do this: highlight the link, right-click, and do copy-as... plain text. $\endgroup$ Commented Mar 9, 2016 at 16:28

1 Answer 1

0
$\begingroup$
mylongstring = "12345678910111213141516171819202122"; "http://www.google.com/analysis/key=" <> mylongstring 

If your window is narrow, Mathematica will insert a new-line character. Try opening your window nice and wide. It worked for me.

$\endgroup$
1
  • 4
    $\begingroup$ In the Mathematica window it displays normally. However, an extra \ is added to the string when copying it out to somewhere else. $\endgroup$ Commented Mar 9, 2016 at 16:10

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.