Two Byte Space and System.IO.DirectoryNotFound Exception in Japanese .Net Application

If you are doing IO operations in .Net applications in Japanese Environment (Multibyte), you need to take care two byte spaces in the Directory name (I mean the last character of the directory name is two/multi byte space) otherwise you will end up in getting System.IO.DirectoryNotFound Exception in case if you do not included “\” at the end of the directory

Example:

string[] fileList = System.IO.Directory.GetFiles(<path to the directory>)

1. <path to the directory> => c:\xxx\yyy ”

2. <path to the directory> => “c:\xxx\yyy \”

If you use 1 , you will end up in getting System.IO.DirectoryNotFound Exception

Note:
You cannot create directory with the last character as single byte space in windows explorer but the two/multi byte space is allowed.

2 thoughts on “Two Byte Space and System.IO.DirectoryNotFound Exception in Japanese .Net Application

  1. Pingback: Right Career for me

  2. I have been browsing online more than 4 hours today, yet
    I never found any interesting article like yours. It’s pretty worth enough for me.
    In my view, if all webmasters and bloggers made good content as you did, the
    net will be much more useful than ever before.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s