0
$\begingroup$

This question already has an answer here:

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$

marked as duplicate by MarcoB, user9660, m_goldberg, Yves Klett, Michael E2 Mar 10 '16 at 12:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 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$ – MarcoB Mar 9 '16 at 16:28
  • $\begingroup$ Do this: highlight the link, right-click, and do copy-as... plain text. $\endgroup$ – march Mar 9 '16 at 16:28
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$
  • 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$ – Louis Yu Mar 9 '16 at 16:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.