I need to write a contract that uses verbiage from a latin based language. Which takes special characters such as é, ç, ã, ô
etc....
I'm using Hard hat to write it.
I've found an example here, also using open Zeppelin:
When trying to write something similar in my contract I get an error: Invalid character in string.
contract Ouro is ERC20, Ownable {
string public constant tokenMinuta = "Céu, Carraço"; // "Céu, Carraço" is the Problem to solve here
constructor() ERC20("Ouro", "ORO") {
_mint(msg.sender, 1000000000 * 10**decimals());
}
function mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);
}
}
I then added UTF-8-encoded to those caracters with hopes that would compile correctly on either BSCScan or EtherScan:
i.e. string public constant tokenMinuta = "C\xC3\xA9u, Carra\xC3\xA7o";
The above compiles as it should in my terminal see here:
However it does not work when I add the source code to BSCScan or EtherScan.
Special Character not compiled on a human readable way
See where I added the UTF-8 - My hope is that this would compile on a human readable way and not like these:
My question is: How can I write those special characters in the body of contract without getting compiling errors and therefore be able to verify that contract with those characters on a humanly readable ways on either BSCSan or EtherScan? To work just like the very first example I've provided above.