Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6742 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Is it possible to alter the text encoding of a field or record export? I am trying to export the contents of a text field, for use in another application.

Currently the text encoding is coming out as Unicode (UTF-16), but I need it to be either: UTF-8,

Western (Mac OS Roman) or

Western (Windows Latin 1).

I can change the encoding in Text Edit and I assume write an AppleScript to do this automatically, but I'd prefer to have it all done within Filemaker if possible.

Any thoughts?

Thanks in advance.

Posted

All of the character sets available for Export Records are shown in the Specify Field for Export dialog you get after specifying the export file name in the first dialog.

Thanks John Mark, I'm aware of these options, but are any of them { Windows (ANSI); ASCII (DOS); Macintosh; Unicode (UTF-16); Japanese (Shift-JIS) } the encoding that I need?

Thanks

Posted

That I don't know since I am not familiar with the encoding types. But, I am guessing none of the available types are UTF-8 or else it would have listed that way. You'll probably need parse the export file with scripting language like AppleScript.

Posted

John, I'm glad to hear you say that you're not familiar with encoding types. Because it sometimes drives me a little crazy. It's hard to become familiar with something you can't easily see :P-]

XML export uses UTF-8 as the default (except for a DDR, which is also UTF-16). So, if you write an xsl stylesheet you can get your data as UTF-8. If you're only exporting 1, or a few fields, it is not difficult.

I believe FileMaker uses UTF-16 because it is the most capable. But, while it may be the encoding of the future, it would be nice if they'd let us use UTF-8 also.

Posted

So, if you write an xsl stylesheet you can get your data as UTF-8. If you're only exporting 1, or a few fields, it is not difficult.

Hi Fenton

At the risk of being cheeky, how would I go about writing an xsl stylesheet? I don't have any experience of this. Can you point me in the direction of any resources / posts in these forums?

Thanks in advance.

Posted

Here is your basic Tabbed text export wXML XSL stylesheet (grammar choice is the default, FMXMLRESULT). It will also work with 1 field and 1 record (though in that case you don't really need the tabs and returns). It does not care what the field(s) are; it just does 'em all. The "return" character is a ASCII 10, a Unix line feed, which is the standard from Mac OS X, esp. UTF-8. You could alternatively use instead, a old-style Mac return.


<?xml version="1.0" encoding="utf-8"?>



xmlns:fm="http://www.filemaker.com/fmpxmlresult" exclude-result-prefixes="fm" >

	

	

		

			

				

				

					

				

			

			

				

			

		 

	



Posted

Fenton, you're an absolute star, thank you. I've only taken a quick look at the file, but I'm sure that I'll be able to work it out.

Thanks once again.

Posted

Hi Fenton

One more thing...

Is it possible to change the encoding of the xml output? I see that the encoding is specified by the xsl file, but changing the encoding here (to "windows latin 1") doesn't affect the output encoding (still says UTF-8 in the export dialogue box). Am I stuck with UTF-8?

Thanks

Posted

Is it possible to change the encoding of the xml output? I see that the encoding is specified by the xsl file, but changing the encoding here (to "windows latin 1") doesn't affect the output encoding (still says UTF-8 in the export dialogue box). Am I stuck with UTF-8?

Think I may have answered my own question...

A search of the W3C website (here) came up with "ISO-8859-1" as the Windows Latin 1 setting. Just need to work out what to use for the "Western (Mac OS Roman)" option now!

Cheers

Posted (edited)

Yes, you're right, that it still says "UTF-8" as the FileMaker export type; because that is what it's exporting. You're changing it later with the XSL.

The Macintosh Roman encoding is, strangely enough, "macintosh" (at least according to BBEdit).

And you'd want to change the line endings to " " (Mac), not " " (Unix). Though most modern Mac text editors will open and display them the same without a fuss.

Edited by Guest
Posted

Thanks again Fenton, I think I get it now.

However...

And you'd want to change the line endings to "

" (Mac), not "

" (Unix). Though most modern Mac text editors will open and display them the same without a fuss.

What do you mean by this? Do I need to alter the xsl file more than just changing the encoding? Is this just for Mac / Unix? What about Windows?

Sorry for all the questions!

Posted (edited)

I think the best solution is to use just "

" A modern Mac will open it fine. Windows XP should also open it OK, if the application can open Unicode. (Read on however, for Windows glitch.)

Alternatively, for Windows-only line endings you use BOTH 13 and 10; carriage return (CR) and line feed (LF):P


The above works fine if done on a Mac, but I've had problems doing the export on Windows. For some reason it would produce an extra CR: CRCRLF

It seemed to be something in the FileMaker XML/XSL parser, as I certainly didn't include it. This was consistent no matter what application I used to look at the result, NotePad, Programmers NotPad, EditPad. The encoding was specified as UTF-8, which it had to be, for eBay File Exchange.

In fact it would do this even if you only specified #10, LF. I got fed up with Windows and used Troi File to Substitute out the CR's. It was for a client on Windows.

Edited by Guest
Posted

That first line is supposed to end with


.

It gets translated by the HTML renderer. You cannot edit your post or even the above would get whacked.

This topic is 6742 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.