【问题标题】:How would I encode a forward slash (/) in a file name and not in an URL?如何在文件名而不是 URL 中编码正斜杠 (/)?
【发布时间】:2018-05-16 16:12:13
【问题描述】:

如何在文件名而不是 URL 中编码正斜杠 (/)?

我在网上找不到任何关于文件名的信息,只有 URL。

此外,我不想用 0_5_oz 或其他替代品来代替 1/2 oz。

For example: http://lemon_1/2_oz.php

http://lemon_1%2f2_oz.php resolves as http://lemon_1%2f2_oz.php  (creates and error)

http://lemon_1∕2_oz.php resolves as http://lemon_1/2_oz.php (also fails)

I tried the following character replacements and both failed:

ASCII UTF-8: %2f

Unicode Character HTML Entity (decimal): ∕

Other options, but I also think they will fail"

/

/

/

Thank you

【问题讨论】:

    标签: html escaping


    【解决方案1】:

    您不能在通过查询字符串检索文件的文件名中使用正斜杠。浏览器会选择这个并期望找到一个网页。同样,如果您将其用于文件路径,您也会遇到问题。

    其他不可用的字符包括(windows):

    \ / : * " < > |

    【讨论】:

    • 谢谢,但我已经知道了。我需要在文件名中编码 /。
    • 答案是否定的,不可能。
    猜你喜欢
    • 2012-07-13
    • 2016-10-29
    • 2010-10-10
    • 2020-11-12
    • 1970-01-01
    • 1970-01-01
    • 2011-11-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多