Pro Hyperlink breaks with special characters

372
17
Jump to solution
11-27-2019 07:07 AM
Highlighted

We have paths and file names with special characters:  L:\Path\MATT'S ADDN BLK 1,2,&3.TIF.  I know this is a terrible thing to do, but it was done long ago before my time here.  My guess is it is due to the special characters.

The paths are stored in an attribute and I am using that as a hyperlink in a custom popup.  The ones which do not have special characters of course open fine.  But I get the following error below on the ones that do. Hitting Yes does nothing.

This is not a problem in using the ArcMap hyperlink (lighting bolt).

   

arcmap equivalency‌ arcmap equivalent

Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Reply
0 Kudos
17 Replies
Highlighted
Esri Regular Contributor

The single quote is causing the script error.  I don't know of a way to work around this in ArcGIS Pro, other than removing the single quote from the file names.

Reply
0 Kudos
Highlighted
MVP Esteemed Contributor

Depends on how the strings are quoted.  How software interprets a path is another issue, but even microsoft recommends against space and punctuation.  Unix is more forgiving 

p = r'L:\Path\MATT'S ADDN BLK 1,2,&3.TIF'    # ---- single quote raw encoding
File "<ipython-input-5-7dbd339e92b6>", line 1
p = r'L:\Path\MATT'S ADDN BLK 1,2,&3.TIF'
^
SyntaxError: invalid syntax


p = r"L:\Path\MATT'S ADDN BLK 1,2,&3.TIF" # ---- double quote raw encoding

q = p.replace("\\", "/")

q
"L:/Path/MATT'S ADDN BLK 1,2,&3.TIF" # ---- safe anywhere
Highlighted

Thanks Dan!  This fixes the problem.  

Edit:  Seemed like an expression would be the fix, I still get the same error.

Replace($feature.Plat_HL,"\\", "/")

Highlighted
MVP Esteemed Contributor

you are using arcade, path delimiter replace is for python, no clue how arcade handles paths and unsavory characters

maybe Xander Bakker‌ knows

Highlighted

Thanks Dan!  Unfortunately Python is not an option in Pro popups. 

Reply
0 Kudos
Highlighted
Esri Regular Contributor

Matthew,

I tried using Arcade to workaround the link issue, and I think internal Popup window code is interfering.  I have raised this with the team that works on Popups.

For example when a file path is typed in, the popup changes the string

The popup link trips over the ' in the file name.

Mark

Highlighted

Customer support thinks it is because of Arcade, not the popup.

"...I was discussing this case with my manager, and we believe the differences seen in hyperlink behavior between ArcMap and ArcGIS Pro relate to how the two programs are coded. ArcMap does not have Arcade integrated into its background processes, while ArcGIS Pro does. This changes how the two programs function at a fundamental level..."

So this leads to why is Arcade the only option for customizing popup's other than getting into the SDK?

Reply
0 Kudos
Highlighted
MVP Esteemed Contributor

Good question... was python used before? (I don't do popups ) or is it some web thing?

Reply
0 Kudos
Highlighted

Yes VBScript, Python and JScript are all options available for Display Expressions in ArcMap.  

Reply
0 Kudos