Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

I have built CI tools in FileMaker for generating config files for services such as postgres, nginx, apache, and others

Featured Replies

I have built CI tools in FileMaker for generating config files for services such as postgres, nginx, apache, and others. It all looks good, however the output is UTF-16 with some odd line breaks, Windows-like?

$ exa -T sites-available
sites-available
├── api.domain.tld
├── document.domain.tld
├── filemaker.domain.tld
├── graphql.domain.tld
├── rest.domain.tld
├── soap.domain.tld
├── webrtc.domain.tld
├── www.domain.tld
└── www2.domain.tld

Is there a way to set the settings for these export field contents as UTF-8 with regular unix line breaks? Even though this is written to a local folder on a workstation git handles the transfer to the server itself. Right now I have to do on a Mac or in unix/linux quite simply( published the one liner on gist: https://gist.github.com/TyrfingMjolnir/17e5f7de32ba6b36964622a2d0e1392b 😞

iconv -f UTF-16 -t UTF-8 sites-available/api.domain.tld | tr "\r" "\n"

however for Windows not necessarily that easily

 

before I do

git push

 

Edited by ggt667

9 minutes ago, ggt667 said:

Is there a way to set the settings for these export field contents as UTF-8 with regular unix line breaks?

Starting from version 16, you can control the encoding and the line endings of the exported file using the method described here:

 

  • Author

You mention some workaround inside FileMaker? Similar to this one: https://filemakerhacks.com/2017/05/09/export-field-contents-update-for-fm-16/ Poor Beverly, That's not a fix, it's an insult to people's intelligence.

 

From what you write I assume there is no way to set the line breaks and encoding of the Export Field Contents?

Edited by ggt667

  • Author
25 minutes ago, Wim Decorte said:

https://fmhelp.filemaker.com/help/18/fmp/en/#page/FMP_Help%2Ftextencode.html

As @comment indicates, we've had these functions since FM16.  Not a workaround, pure native functions.

If you were expecting to apply the encoding and line-endings as options on the export field contents dialog itself, then no. That's not how it works.

Thanks, then "AppleScript DoShellScript()" it is

If I should ever run the solution on Windows, I may look into the way you describe.

Edited by ggt667

I'm afraid you're speaking in riddles; why would you use applescript?  What is described in the FM helps works without it.  And works the same in FM as in Windows.

 

  • Author

As that's the way it's already implemented, doing the reformatting in FileMaker does not really do it better; or worse.

In which case would one ever benefit from using \r as line break and UCS-16 or UTF-16 as encoding? It makes regular text double the size.

In my case I have just below 200 nginx vhost files, there is about 20 of them pr solution and development, testing and production for each.

Edited by ggt667

You could use a plugin such as BaseElements to export to a text file. Then you can parse line by line and add whatever line ending you want.

  • Author

I gave this( https://filemakerhacks.com/2017/05/09/export-field-contents-update-for-fm-16/ ) a shot.

Set Field[
  myTable::ExportFldContainer; TextEncode(
    GetLayoutObjectAttribute( "SomeMergeFieldObject", "content"
                            ); "utf-8"; 3 ) ]

The value of `myTable::ExportFldContainer` is "utf-8"

Also the following yields the same proceeds

Set Field[
  myTable::LayoutObjectContent; GetLayoutObjectAttribute(
    "SomeMergeFieldObject", "content" ) ]
Set Field[
  myTable::Output; TextEncode( myTable::LayoutObjectContent; "utf-8"; 3 ) ]

 

Edited by ggt667

1 hour ago, ggt667 said:

The value of `myTable::ExportFldContainer` is "utf-8"

If you have done what you describe, and the field myTable::ExportFldContainer is indeed a container field, then it will contain a file named "utf-8.txt". This file will be UTF-8 encoded and contain the content of the merged text object, with LF line endings.

--
As a side note, I am not sure why you would want to go to through the layout and export a merged field instead of remaining at the data level and export the field itself. 

 

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.