Bug 322830 (MONO80132) - Importing file with accent in filename give errors
Summary: Importing file with accent in filename give errors
Status: RESOLVED WORKSFORME
Alias: MONO80132
Product: MonoDevelop
Classification: Mono
Component: general (show other bugs)
Version: 0.10
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: MD Bugs
QA Contact: MD Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-02 20:43 UTC by Olivier Toupin
Modified: 2008-01-09 10:28 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 20:18:14 UTC


---- Reported by olivier.toupin@gmail.com 2006-12-02 13:43:08 MST ----

Please fill in this template when reporting a bug, unless you know what you
are doing.
Description of Problem: MonoDevelop doesn't seem to support accent in
filename when importing file.


Steps to reproduce the problem:
1. In my case I took a Vs.NET 2005 project that I tranfert to the VMWare image
2. Open MonoDevelop, start a new lib project 
3. Using context-menu over the project Click AddFiles...
4. Choose a file whit an accent like Aéroport.cs
5. Boom it say a pretty error. Remove the accent and I work

Actual Results:
An error

Expected Results:
Importation

How often does this happen? 
Always!


Additional Information:



---- Additional Comments From jacobilsoe@gmail.com 2006-12-13 16:02:59 MST ----

What error do you get? I cannot reproduce it.



---- Additional Comments From olivier.toupin@gmail.com 2006-12-29 19:38:29 MST ----

I just retested it and I got the same bug



---- Additional Comments From olivier.toupin@gmail.com 2006-12-29 19:42:00 MST ----

Here the message I get

Exception occurred: Exception has been thrown by the target of an
invocation.

System.Reflection.TargetInvocationException: Exception has been thrown
by the target of an invocation. ---> GLib.GException: Invalid byte
sequence in conversion input
  at GLib.Marshaller.FilenamePtrToString (IntPtr ptr) [0x00000]
  at GLib.ListBase.DataMarshal (IntPtr data) [0x00000]
  at GLib.ListBase+ListEnumerator.get_Current () [0x00000]
  at GLib.ListBase.CopyTo ( System.Array array, Int32 index) [0x00000]
  at GLib.Marshaller.ListToArray (GLib.ListBase list, System.Type
type) [0x00000]
  at Gtk.FileChooserDialog.get_Filenames () [0x00000]
  at
MonoDevelop.Ide.Gui.Pads.ProjectPad.FolderCommandHandler.AddFilesToProject
() [0x00000]
  at <0x00000> <unknown method>
  at (wrapper managed-to-native)
System.Reflection.MonoMethod:InternalInvoke (object,object[])
  at System.Reflection.MonoMethod.Invoke (System.Object obj,
BindingFlags invokeAttr, System.Reflection.Binder binder,
System.Object[] parameters, System.Globalization.CultureInfo culture)
[0x00000] --- End of inner exception stack trace ---

  at System.Reflection.MonoMethod.Invoke (System.Object obj,
BindingFlags invokeAttr, System.Reflection.Binder binder,
System.Object[] parameters, System.Globalization.CultureInfo culture)
[0x00000]
  at System.Reflection.MethodBase.Invoke (System.Object obj,
System.Object[] parameters) [0x00000]
  at MonoDevelop.Components.Commands.CommandHandlerInfo.Run
(System.Object cmdTarget) [0x00000]
  at MonoDevelop.Components.Commands.CommandManager.DispatchCommand
(System.Object commandId, System.Object dataItem, System.Object
initialTarget) [0x00000] 



---- Additional Comments From fejj@novell.com 2007-04-30 10:42:49 MST ----

probably the filename charset encoding isn't the same as your
environment's charset encoding so it doesn't know how to convert the
filename into UTF-8



---- Additional Comments From fejj@novell.com 2007-05-23 18:01:13 MST ----

<jeff_> looks like the strings returned by
gtk_file_chooser_get_filenames() might not be valid utf8?
<lewing> jeff_: you need to read the filename docs
<jeff_> where can I find those?
* vgeddes (~vgeddes@dsl-245-174-39.telkomadsl.co.za) has left #gtk+
<jeff_> lewing: does f-spot deal with a similar problem?
<lewing>
http://developer.gnome.org/doc/API/2.0/glib/glib-Character-Set-Conversion.html#g-filename-display-name
<lewing> jeff_: fortunately image file names are fairly basic most of
the time
<jeff_> yea, I figured...
<jeff_> this looks to actually be a problem with gtk-sharp tho
<jeff_> :(
<lewing> jeff_: I've talked to mkestner about the issue, I don't know
if he has any plans to fix it
<jeff_> ok
<lewing> it is


I'm going to reassign this to gtk-sharp, although I don't really see
how mike can truly fix this in any sort of general way. While he
/could/ use the g_filename_display_*() variants to convert to UTF-8,
but then the consumer code wouldn't necessarily be able to get the
actual physical filename (e.g. if the filename was not in UTF-8 to
begin with... or at the very least, not in the env encoding)

not sure what can really be done here.



---- Additional Comments From mkestner@ximian.com 2007-05-23 18:39:23 MST ----

I think the issue lewing had identified is different from this.  The
filename encoding stuff should be working as it's supposed to in Gtk#.
That has been fixed for a long time now.  We convert the filename
encoding returned by Gtk+ to utf8 using glib transformation methods,
so if there is an issue, it is probably with the environment or the
glib code.

I'm going to need a lot better description of how to reproduce the
problem or a sample to reproduce it. 



---- Additional Comments From mkestner@ximian.com 2007-05-24 11:01:58 MST ----

Reassigning to MonoDevelop since from talking to jeff, the issue seems
to be related to roundtripping and not the value that is coming from Gtk#.



---- Additional Comments From fejj@novell.com 2007-05-24 11:29:54 MST ----

well, it's kinda both :)

but it also sounds like recent versions of gtk# call
g_filename_to_utf8() on the filenames returned from
gtk_file_chooser_get_filenames(), so this particular exception likely
no longer happens.

As mike was referring to, the problem /now/ will be that we will have
a filename String which, when used, will be used as a utf8 string to
the filesystem... which it is not.

simplest solution? only allow filenames in utf8.

trying to support non-utf8 filenames is a huge pain, because they
don't even necessarily have to be in the locale charset... so
converting a String back to the original encoding is impossible.

what will eventually need to be done is to have gtk#'s filechooser
give us back something like:

struct {
   string filename;
   byte[] fsname;
}


but then every gtk# app would have to be fixed to use that instead of
the current interface... (even most c-based gtk apps likely have this
problem because most apps expect filenames in utf8 and probably break
when they aren't)


Unknown bug field "cf_op_sys_details" encountered while moving bug
   <cf_op_sys_details>SLED 10</cf_op_sys_details>
Unknown operating system other. Setting to default OS "Other".

Comment 1 Lluis Sanchez 2008-01-09 10:28:42 UTC
"sounds like recent versions of gtk# call g_filename_to_utf8() on the filenames returned from gtk_file_chooser_get_filenames(), so this particular exception likely no longer happens". Closing then.