I need to write a contract that uses verbiage from a latin based language. Which takes special characters such as é, ç, ã, ô
etc…
I’ve found an example here, also using open Zeppelin:
See line 520 532
https://etherscan.io/address/0xd15db6e8203fb3f9ce70714b306a1a2b03ebfe45#code
When trying to do 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.
https://testnet.bscscan.com/address/0x0C2cF99Fa25429B95C2916025997d91bdB0fEcE5#code
See where I added the UTF-8 - My hope is that this would compile on a human readable way and not like these:
My issue is how can 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.