This is the mail archive of the
java-prs@gcc.gnu.org
mailing list for the Java project.
[Bug libgcj/31939] Command line arguments are byteswapped before being passed to the program runing in custom locale.
- From: "serg at vostok dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: java-prs at gcc dot gnu dot org
- Date: 18 May 2007 19:07:11 -0000
- Subject: [Bug libgcj/31939] Command line arguments are byteswapped before being passed to the program runing in custom locale.
- References: <bug-31939-14546@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from serg at vostok dot net 2007-05-18 20:07 -------
For subject 2.
The point is to find where arguments of "int main(int argc, char** argv)" are
converted into java.lang.String to be passed to "static void main(String[]
args)".
Trail:
gcc/java/jvgenmain.c:
int main(int argc,char **argv)
constructs a C code to call the main java method with
JvRunMain(classname,argc,argv)
libjava/prims.cc:
void JvRunMain (jclass klass, int argc, const char **argv)
simply calls
_Jv_RunMain (klass, NULL, argc, argv, false)
void _Jv_RunMain (jclass klass, const char *name, int argc, const char **argv,
bool is_jar)
simply calls
_Jv_RunMain (NULL, klass, name, argc, argv, is_jar)
void _Jv_RunMain (JvVMInitArgs *vm_args, jclass klass, const char *name, int
argc, const char **argv, bool is_jar)
calls
JvConvertArgv (argc - 1, argv + 1)
JArray<jstring> * JvConvertArgv (int argc, const char **argv)
copies each argument into jbyteArray bytes, then calls
new java::lang::String (bytes, 0, len)
to make a String from it with a default encoding.
libjava/java/lang/String.java:
public String(byte[] data, int offset, int count)
calls
init (data, offset, count,System.getProperty("file.encoding", "8859_1"))
libjava/java/lang/natString.cc:
void java::lang::String::init (jbyteArray bytes, jint offset, jint count,
jstring encoding)
uses
gnu::gcj::convert::BytesToUnicode::getDecoder(encoding)
to make a converter
and
converter->read(array, outpos, avail)
to convert data
libjava/gnu/gcj/convert/BytesToUnicode.java:
class BytesToUnicode extends IOConverter
public static BytesToUnicode getDecoder (String encoding)
uses eigther
new Input_iconv(encoding)
or
new BytesToCharsetAdaptor(Charset.forName(encoding))
Looks like I will have to test both Input_iconv and BytesToCharsetAdaptor to
see if any of them is buggy.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31939