I am trying to use the XComponentLoader to open a document in OpenOffice 3.0 (or 2.4, same problem) from a C++ program. The file is name blå.txt (third letter is the å character). In my program the file name is UTF-8 encoded. Before passing the file name to the ComponentLoader I use FileBase::getFileURLFromSystemPath(), to create the URL. Since getFileURLFromSystemPath() takes the "system path" as an OUString, I create an OUString from my UTF-8 file name -- using RTL_TEXTENCODING_UTF8. On Windows XP and Mac platforms this works fine, ie. the file is found and opened. On Linux, however, OpenOffice cannot find the file.
On Linux, the file has a name that is just a sequence of bytes -- in my case "blå.txt" encoded in UTF-8 (ie. eight bytes, excluding the terminating '\0'). And I guess the reason that OpenOffice cannot create a valid URL from my OUString "system path" is that I have nowhere to specify that I use the UTF-8 encoding.
So what is it that I don't get here..? And does anyone know how to solve my problem..?
I have tried to use the ExternalUriReferenceTranslator on the URL that I get from getFileURLFromSystemPath(). This works on Linux but doesn't work on the other platforms -- and I can't see why it should be nescessary...
Kind regards,
Mike
[C++] File URIs with non-ascii characters
Java, C++, C#, Delphi... - Using the UNO bridges
Jump to
- Getting started
- ↳ Survival guide
- ↳ Beginners
- ↳ Getting Started Guide for 4.x
- ↳ Getting Started Guide for 3.x
- ↳ Install, Setup and Troubleshooting
- ↳ Admin Guide
- ↳ MS Windows
- ↳ Linux
- ↳ Mac OSX
- ↳ LibreOffice
- ↳ Tablets
- ↳ Tutorials
- ↳ Writer
- ↳ Calc
- ↳ Base
- Applications
- ↳ Writer
- ↳ Writer Guide for 4.x
- ↳ Writer Guide for 3.x
- ↳ Writer Tutorials
- ↳ Templates
- ↳ Advanced Uses
- ↳ Calc
- ↳ Calc Guide for 4.x
- ↳ Calc Guide for 3.x
- ↳ Calc Functions
- ↳ Calc Tutorials
- ↳ Impress
- ↳ Impress Guide for 4.x
- ↳ Impress Guide for 3.x
- ↳ Draw
- ↳ Draw Guide for 4.x
- ↳ Draw Guide for 3.x
- ↳ Math
- ↳ Math Guide for 4.x
- ↳ Math Guide for 3.x
- ↳ Math Guide for 3.x
- ↳ Base
- ↳ Base Guide for 4.x
- ↳ Wiki
- ↳ Base Tutorials
- ↳ Tables & Queries
- ↳ Forms
- ↳ External Data Sources
- ↳ Reporting
- ↳ Database Examples
- Customizing and Extending
- ↳ Macros and UNO API
- ↳ Basic Guide
- ↳ Code Snippets
- ↳ Extension Repository
- ↳ Macro Repository
- ↳ External Programs
- ↳ Extensions
- ↳ Extensions page
- Community
- ↳ General Discussion
- ↳ Site Feedback
- ↳ Forum Governance
- ↳ User Experience (UX)
- ↳ Announcements
- Business
- ↳ Institutions & Educational
- ↳ Paid support
- ↳ Consultants Directory