1

I combed through the Using the compiler section in the Solidity documentation, but I couldn't find an answer for my question.

Do file names need to be valid UTF-8 for solc to be able to compile them?

6
  • To be precise, Solidity is not a compiler, it's a language. Otherwise no idea. Dec 26, 2020 at 15:07
  • To continue the comment above, assuming that your question is therefore about solc, the answer is yes, since it is implemented in C++, and all path names are passed via std:::string, as you can see in the source code. Dec 26, 2020 at 16:08
  • Thanks both for the correction. I updated the question body to refer explicitly to "solc". Dec 26, 2020 at 16:09
  • Well then, like I said, this compiler is implemented in C++, and it uses std:::string conclusively. So whatever string format is supported by this type, is also supported by the compiler for file paths and names. Dec 26, 2020 at 16:39
  • Your comments make for a perfectly legit answer. Dec 26, 2020 at 16:49

1 Answer 1

1

The Solidity Compiler (solc) is implemented in C++ (see here).

It uses std::string conclusively, and that includes file names.

Subsequently, whatever string format is supported by this type, is also the string format which you must use when passing file names as input to the compiler.

2
  • I accepted the answer, but just to clear any doubt: does std::string enforce UTF-8? I am not familiar with C++. Dec 26, 2020 at 17:04
  • @PaulRazvanBerg: To my knowledge it supports ASCII, and it happens to allow UTF8 as well. Dec 26, 2020 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.