From the official docs:
Hexadecimal literals in some ways behave like string literals but are not implicitly convertible to the string type.
Source: https://docs.soliditylang.org/en/v0.8.21/types.html#hexadecimal-literals
This may not be entirely accurate. I have observed that implicit conversion works fine PROVIDED that hex literal is encoded in UTF-8.
For example:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
contract Hex {
function HexToString() public pure returns (string memory x) {
//x = "hello"
x = hex"68656c6c6f";
}
}
Let me know if its worth while to update the documentation.