Package: mono
Version: 1.1.9.2-1
Severity: normal


Hello,

   I'm trying to write accentuated characters on a sql database (using sqlite). 
The problem is that I can not write accentuated characters if they are read 
from a 
external process. Writing accentuated chars from a string works, reading them 
through the "echo" command also works, but reading them from a file doesn't 
(even 
if the file was created with the same 'echo' command). I think all of my 
system is UTF-8, so I'm not sure why this fails.... :-?

I have suplied an test example with the problem (cut&paste to "test.cs").

To compile and run the test do:

$ echo áéíóú > /tmp/echoout.txt
$ mcs test.cs -r:System.Data.dll -r:Mono.Data.SqliteClient.dll
$ rm /tmp/SqliteTest.cs
$ mono test.exe


The result I get is:

string: áéíóú

echo: áéíóú


While expected output should be:

string: áéíóú

echo: áéíóú

cat: áéíóú





%%%%%%%%%%%%% Test file "test.cs"
/* To compile use: mcs test.cs -r:System.Data.dll -r:Mono.Data.SqliteClient.dll 
*/

using System;
using System.Data;
using Mono.Data.SqliteClient;


public class Test 
{

        static public string get_info (bool cat_vs_echo)
        {

                /* Execute the external program to get the mime info */
                System.Diagnostics.Process proc = new 
System.Diagnostics.Process();
                
                proc.EnableRaisingEvents = false;
                proc.StartInfo.UseShellExecute = false;
                
                if (cat_vs_echo) {

                        proc.StartInfo.FileName = "cat";
                        proc.StartInfo.Arguments = "/tmp/echoout.txt";

                } else {

                        proc.StartInfo.FileName = "echo";
                        proc.StartInfo.Arguments = "áéíóú";
                }

                proc.StartInfo.RedirectStandardOutput = true;                   
                proc.Start();
                proc.WaitForExit();

                return (proc.StandardOutput.ReadToEnd ());
        }






        public static void Main(string[] args)
        {
                // Create sql database
                string connectionString = "URI=file:/tmp/SqliteTest.db";
                SqliteConnection dbcon;
                dbcon = new SqliteConnection(connectionString);
                dbcon.Open();
                SqliteCommand dbcmd = new SqliteCommand("CREATE TABLE files (id 
INTEGER,name TEXT)", dbcon);
                dbcmd.ExecuteNonQuery();
                dbcmd.Dispose ();
        
                
                // Try to put some info with accentuated characters
                string namein, sql;

                namein = "string: " + "áéíóú\n";
                sql = String.Format ("INSERT INTO files (id,name) VALUES 
(1,'{0}')", namein);
                dbcmd = new SqliteCommand (sql,dbcon);
                dbcmd.ExecuteNonQuery();
                dbcmd.Dispose ();

                namein = "echo: " + get_info (false);
                sql = String.Format ("INSERT INTO files (id,name) VALUES 
(1,'{0}')", namein);
                dbcmd = new SqliteCommand (sql,dbcon);
                dbcmd.ExecuteNonQuery();
                dbcmd.Dispose ();

                namein = "cat: " + get_info (true);
                sql = String.Format ("INSERT INTO files (id,name) VALUES 
(1,'{0}')", namein);
                dbcmd = new SqliteCommand (sql,dbcon);
                dbcmd.ExecuteNonQuery();
                dbcmd.Dispose ();
                
                
                // Try to get data back from SQL table
                sql = "SELECT name FROM files WHERE id = 1";
                dbcmd = new SqliteCommand(sql,dbcon);
 
                IDataReader reader = dbcmd.ExecuteReader();
                while(reader.Read()) {
                        Console.WriteLine((string)reader["name"]);
                }

                // clean up
                reader.Close();
                dbcon.Close();
    }

 }       

%%%%%%%%%%%%%%% end of test file "test.cs"




-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.13.4
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=UTF-8)

Versions of packages mono depends on:
ii  mono-common                   1.1.9.2-1  common files for Mono
ii  mono-jit                      1.1.9.2-1  fast CLI (.NET) JIT compiler for M

mono recommends no packages.







-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to