Jump to content

Exporting to utf 8 html


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

Recommended Posts

Hi all

I've been developing a database that allows my database to update certain pages of a website with information on my database however I'm having trouble exporting it in utf 8. In normal circumstances I wouldn't mind going through the pages and re-encoding them in Notepad++ but when it comes to several pages, I need an automated solution. Can anyone provide a preferably free way to do this.

Thanks

Ineva.

Link to comment
Share on other sites

You need to tell use what you're doing that you can't export as utf-8. Because it is one of the Export options. Perhaps you are actually trying to Export Field Contents instead, which is always utf-16.

A solution is to use the regular Export, with only 1 record found, just that one field. One method to do this without disrupting the found set is to create a New Window, Show All Records, Omit Record, Show omitted only, Export, Close window.

Link to comment
Share on other sites

ok since more detail is required here goes..I have 2 tables

Table_IMPORT_HTML

Fields - HTML_CODE_LINE

Table_EDIT_HTML

Fields - HTML_CODE

there are more fields but they arent required here.

to import a html document I do the following

Delete all records in Table_IMPORT_HTML

Import HTML file which imports each line of the HTML doument as a new record

I then copy all records in Table_IMPORT_HTML and paste them in Table_EDIT_HTML::HTML_CODE

---

edits are made to the field

---

then I export field contents, which as you said only exports as utf 16 :)

Fenton I tried what you said but when you export like that it forces it all into a HTML table

Link to comment
Share on other sites

Well, it could be just because your computer thinks it is an html file, and supplies a table (for some reason). I'd advise you to open it with a text editor, ie., something other than a web browser. Are you giving it an extension of ".htm"? It is probably fine; Internet Explorer is rendering it how it thinks fit.

Link to comment
Share on other sites

Exporting from FM would naturally escape out all necessary HTML entities to appropriately display the field information. Imagine what would happen if someone exported 200 records with 10 fields and one of those fields in on of those records had: - the whole structure would collapse.

Specifically, the entities that are escaped in this case are: < and >.

Your preferably free way of doing this would be opening it up in Notepad++ and replacing all occurances of &lt ; with < and &gt ; with > ... that or just copy and paste the field content.

I can't really see what it is you're trying to achieve though.

Link to comment
Share on other sites

Comment has made the point. You want to Export (a single field) as tab-separated text (with an extension of ".htm". You do not want to Export as HTML. Sounds kind of the same, but is not the same. HTML leads a double life.

Link to comment
Share on other sites

true, but now encoding with tab separated files leads to strange characters which 'can' be eliminated by eliminating the carriage returns in the filemaker field. Doing this however makes the html code almost unreadable since it looses its structure. Is it possible to say insert a utf-8 carriage return at the end of each line while eliminating the filemaker carriage returns?

Edited by Guest
Link to comment
Share on other sites

Yes, that character is ASCII character 11 (Vertical Tab, I think). I don't have that problem on my Mac, as I can write the file directly via command line, which translates the character to a return.

Here's another possibility. Export XML, with this XSL stylesheet. It is written for only 1 record, 1 field. Otherwise you'd have to add more.


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



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

	

	

		

	

Link to comment
Share on other sites

quite simple really genx, My database will be editing html files that have sections of code that are specifically edited by myself where other parts have to be edited by other people..this arrangement cannot be changed and since it is out of my control I am trying to develop a solution similar to the way that dreamweaver handles templates to insert and edit the section of code I am responsible for.

- Fenton I keep getting errors for that xsl code, I dont know much about xml

ERROR:(in regards to the code you gave)

Fatal error at line 0 column 0 .... could not find primary document entity

Link to comment
Share on other sites

Well, Filemaker is not Dreamweaver. Unless you export as XML with a XSL stylesheet, the only way you're going to get proper carriage returns between lines is by making each line a separate record.

I could understand keeping the actual DATA for the site in a database, then exporting new pages (via XML/XSL directly to HTML) as the data is updated. But using Filemaker for maintaining the actual HTML code seems like a poor choice.

Link to comment
Share on other sites

  • 4 months later...

You can use Export Field Contents, which is a fine and simple function to make includes on php webpages.

As mentioned, the files that are made are in utf16 format, with a Byte Order Mark at the beginning.

You must find your solution not within Filemaker but within your webpage to cope with the utf16 problem

http://www.moddular.org/log/utf16-to-utf8

Here is a beautiful utf16 to utf8 translation function (php). Extend it a bit so that it gets the include file to translate, but also puts the file back as utf8. When it gets the file a second time, and finds no utf16 Byte Order Mark, it concludes it is utf8 and will pass it through without translation. But you have to adapt the php for that. Not too difficult.

Happy including

Harry

Link to comment
Share on other sites

  • 2 months later...
  • 1 year later...
  • Newbies

FYI...there were 2 characters missing from the first element in the previous post. I think the forum engine stripped this out so here's the xsl without the 'code' formatting...

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

Edited by Guest
Link to comment
Share on other sites

This topic is 5218 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.