Warning, /frameworks/kdoctools/cmake/uriencode.cmake is written in an unsupported language. File is not indexed.
0001 # Encode an URI according to RFC 2396 0002 # kdoctools_encode_uri takes a variable name and it encodes 0003 # its value according to RFC 2396 (minus few reserved characters) 0004 # overwriting the original value. 0005 # 0006 # SPDX-FileCopyrightText: 2014 Luigi Toscano <luigi.toscano@tiscali.it> 0007 # 0008 # SPDX-License-Identifier: BSD-3-Clause 0009 0010 function(kdoctools_encode_uri _original_uri) 0011 find_package(Perl REQUIRED) 0012 find_package(PerlModules COMPONENTS URI::Escape REQUIRED) 0013 # properly encode the URI 0014 string(REPLACE "\"" "\\\"" escaped_uri "${${_original_uri}}") 0015 execute_process(COMMAND ${PERL_EXECUTABLE} -MURI::Escape -e "print uri_escape_utf8(\"${escaped_uri}\", \"^A-Za-z0-9\\-\\._~\\/:\");" 0016 OUTPUT_VARIABLE encoded_uri 0017 RESULT_VARIABLE res_encoding 0018 OUTPUT_STRIP_TRAILING_WHITESPACE) 0019 if (NOT ${res_encoding} EQUAL 0) 0020 message(FATAL_ERROR "Problem while encoding the URI ${${_original_uri}}") 0021 endif() 0022 set(${_original_uri} "${encoded_uri}" PARENT_SCOPE) 0023 endfunction()