Babem Posted September 1, 2023 Share Posted September 1, 2023 I would like to export a text field, but the characters in the exported file occupy 2 bytes. I would only need the 1-byte character codes. How can I create such an export? I show the problem in this picture. Link to comment Share on other sites More sharing options...
comment Posted September 1, 2023 Share Posted September 1, 2023 Are you using the Export Field Contents instruction? If so, the resulting file uses UTF-16 encoding. There are several methods to produce a UTF-8 encoded file; which one would be most suitable for you depends on what exactly you are doing. For example, you could isolate the record and export it as tab-separated, with only one field in the field export order. But that wouldn't work well if the field contains tabs or carriage returns. Link to comment Share on other sites More sharing options...
Babem Posted September 1, 2023 Author Share Posted September 1, 2023 7 minutes ago, comment said: Are you using the Export Field Contents instruction? If so, the resulting file uses UTF-16 encoding. There are several methods to produce a UTF-8 encoded file; which one would be most suitable for you depends on what exactly you are doing. For example, you could isolate the record and export it as tab-separated, with only one field in the field export order. But that wouldn't work well if the field contains tabs or carriage returns. Yes, I want to export a calculated character chain in a text field, but i need this exactly. The character chain does not contain control or special codes, just letter, numbers and "space" characters. Link to comment Share on other sites More sharing options...
comment Posted September 1, 2023 Share Posted September 1, 2023 Well, you already have one possible method. Briefly, other options are: Use the TextEncode() function to create the file in a global container field; then export the container field's contents (requires v. 16 or higher); Same thing as above, only using the Base64Encode and Base64Decode functions (this works in v.13 and up); Write directly to a data file (requires v.18+); Export the record as XML using a custom XSLT stylesheet; this allows you to choose the target file's encoding and preserve all special characters (works in all versions since v.6) 1 Link to comment Share on other sites More sharing options...
Babem Posted September 1, 2023 Author Share Posted September 1, 2023 36 minutes ago, comment said: ..... Write directly to a data file (requires v.18+); Thanks for the help, writing directly to the file and utf-8 setting solved my problem. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now