Return-Path: <awaresystems.be+caf_=filtered=awaresystems.be@gmail.com>
Delivered-To: filtered@awaresystems.be
Received: from mx-b.one.com (mx-b.one.com [91.198.169.49])
	by mail6.local (Postfix) with ESMTP id 70FC58014E876
	for <filtered@awaresystems.be>; Thu, 21 Mar 2013 15:59:38 +0100 (CET)
X-Virus-Scanned: by one.com
Received-SPF: pass (mx-b: domain of awaresystems.be+caf_=filtered=awaresystems.be@gmail.com designates 209.85.215.47 as permitted sender)
X-Greylist: whitelisted by SQLgrey-1.8.0-rc2
Received: from mail-la0-f47.google.com (mail-la0-f47.google.com [209.85.215.47])
	by mx-b.one.com (Postfix) with ESMTP id CD8AB13F5B61
	for <filtered@awaresystems.be>; Thu, 21 Mar 2013 14:59:37 +0000 (UTC)
Received: by mail-la0-f47.google.com with SMTP id fj20so5258166lab.6
        for <filtered@awaresystems.be>; Thu, 21 Mar 2013 07:59:37 -0700 (PDT)
X-Received: by 10.152.147.130 with SMTP id tk2mr7885736lab.24.1363877977339;
        Thu, 21 Mar 2013 07:59:37 -0700 (PDT)
X-Forwarded-To: filtered@awaresystems.be
X-Forwarded-For: awaresystems.be@gmail.com filtered@awaresystems.be
Delivered-To: awaresystems.be@gmail.com
Received: by 10.114.16.135 with SMTP id g7csp59781ldd;
        Thu, 21 Mar 2013 07:59:36 -0700 (PDT)
X-Received: by 10.112.134.35 with SMTP id ph3mr11675107lbb.110.1363877976064;
        Thu, 21 Mar 2013 07:59:36 -0700 (PDT)
DomainKey-Status: bad format
Received-SPF: neutral (google.com: 195.47.247.147 is neither permitted nor denied by best guess record for domain of tiff-bounces@lists.maptools.org) client-ip=195.47.247.147;
Received: by 10.152.101.148 with POP3 id fg20mf8167441lab.36;
        Thu, 21 Mar 2013 07:59:35 -0700 (PDT)
X-Gmail-Fetch-Info: info@awaresystems.be 1 pop.awaresystems.be 110 info@awaresystems.be
Delivered-To: info@awaresystems.be
Received: from mx-v.one.com (mx-v.one.com [195.47.247.147])
	by mail6.local (Postfix) with ESMTP id E7712801063E5
	for <info@awaresystems.be>; Thu, 21 Mar 2013 15:49:10 +0100 (CET)
X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0-rc2
Received: from lists.maptools.org (ks365428.kimsufi.com [94.23.4.142])
	by mx-v.one.com (Postfix) with ESMTP id D0CC75A801
	for <info@awaresystems.be>; Thu, 21 Mar 2013 15:30:21 +0000 (UTC)
Received: from [10.1.0.241] (localhost.localdomain [127.0.0.1])
	by lists.maptools.org (Postfix) with ESMTP id BA85735C03A;
	Thu, 21 Mar 2013 09:42:46 -0500 (EST)
Received: from blade.simplesystems.org (blade.simplesystems.org [65.66.246.74])
	by lists.maptools.org (Postfix) with ESMTPS id 7FFAA35C039
	for <tiff@lists.maptools.org>; Thu, 21 Mar 2013 09:22:43 -0500 (EST)
Received: from freddy.simplesystems.org (freddy.simplesystems.org
	[65.66.246.65])
	by blade.simplesystems.org (8.14.4+Sun/8.14.4) with ESMTP id
	r2LEMWsU006819; Thu, 21 Mar 2013 09:22:33 -0500 (CDT)
Date: Thu, 21 Mar 2013 09:22:32 -0500 (CDT)
From: Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
X-X-Sender: bfriesen@freddy.simplesystems.org
To: Sunanda Chowdhary <chowdhar@adobe.com>
In-Reply-To: <3C23B351BD1CA0429DAA8ED382F16A1F78DC8937@indiambx01.corp.adobe.com>
Message-ID: <alpine.GSO.2.01.1303210918570.2267@freddy.simplesystems.org>
References: <3C23B351BD1CA0429DAA8ED382F16A1F78DC8907@indiambx01.corp.adobe.com>
	<514B0426.3080100@sidefx.com>
	<alpine.GSO.2.01.1303210834500.2267@freddy.simplesystems.org>
	<3C23B351BD1CA0429DAA8ED382F16A1F78DC8937@indiambx01.corp.adobe.com>
User-Agent: Alpine 2.01 (GSO 1266 2009-07-14)
MIME-Version: 1.0
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2
	(blade.simplesystems.org [65.66.246.90]);
	Thu, 21 Mar 2013 09:22:34 -0500 (CDT)
Cc: Tiff List <tiff@lists.maptools.org>
Subject: Re: [Tiff] TiffOpenW() not opening tiff file containing Japanese
 character
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org

On Thu, 21 Mar 2013, Sunanda Chowdhary wrote:

> Thanks Edward and Bob.
>
> Yes I agree with you Bob. Just for sake of example I wrote that code snippet. I get NATIVE file path from OS API.
>
> As suggested by Edward, I tried opening the file using _wopen() and file is opened successfully. I tried using WideCharToMultiByte() to get char* path and then use TiffOpen(). This also fails.
> Sorry if I missed, does Lib Tiff provide some error handling APIs as well?

You replied only to me rather than the whole list.  Adding the list to 
this reply.

Libtiff provides the functions TIFFSetErrorHandler() and 
TIFFSetWarningHandler() to support setting error and warning 
callbacks, respectively.  Since these are callbacks, you need to 
immediately print or cache the reported error information since 
libtiff continues execution (to point of return to your program) once 
these functions return.  Check the return status from libtiff 
functions so that your program can quit processing on error.

Bob

>
> Thanks,
> Sunanda
>
>
> -----Original Message-----
> From: tiff-bounces@lists.maptools.org [mailto:tiff-bounces@lists.maptools.org] On Behalf Of Bob Friesenhahn
> Sent: 21 March 2013 19:10
> To: Edward Lam
> Cc: tiff@lists.maptools.org
> Subject: Re: [Tiff] TiffOpenW() not opening tiff file containing Japanese character
>
> On Thu, 21 Mar 2013, Edward Lam wrote:
>
>> Hi Sunanda,
>>
>> Which platform are you on? If you're on Windows with Visual Studio,
>> I've personally had problems with it recognizing UTF-8 string literals
>> like in the code you posted. I'd double-check what wname is actually
>> what you think it is. On Windows, you can confirm whether the file can
>> be opened by calling _wopen(wname, ...) and checking if you have a valid file.
>>
>> The other idea is to ensure you have an error handler installed prior
>> to calling TIFFOpenW() and checking to see what is the error generated
>> by TIFFOpenW().
>
>> From what I have read, the definition of a wide character is platform-dependent.  I remember that Windows uses UTF-16 and OS X uses UTF-32.
>
> Ultimately, the value needs to match the value used by the filesystem.
> any small encoding difference would cause a failure to match.  A filename which "looks" the same might not be the same.
>
> Some filesystems support multiple filename encodings and the filesystem remembers the encoding which was used.
>
> The safest thing to do is to obtain the filename via an operating system API and pass that to libtiff.
>
> Bob
> --
> Bob Friesenhahn
> bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
> GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
> _______________________________________________
> Tiff mailing list: Tiff@lists.maptools.org http://lists.maptools.org/mailman/listinfo/tiff
> http://www.remotesensing.org/libtiff/
>

-- 
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
