Just for the record, the flag that solves this problem in the URL connection is:
jdbc:sqlserver://;serverName=localhost;databaseName=master;sendStringParametersAsUnicode=false