Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FZK Viewer can't open gbXML file from Spider #138

Open
EK-CEL opened this issue Aug 1, 2018 · 4 comments
Open

FZK Viewer can't open gbXML file from Spider #138

EK-CEL opened this issue Aug 1, 2018 · 4 comments

Comments

@EK-CEL
Copy link
Collaborator

EK-CEL commented Aug 1, 2018

I have uploaded a gbXML file to the Spider and immediately downloaded it back. There were some differences and I fixed them so that the WinMerge app tells the files as identical (regardless of different file size). Unfortunately I can't open the new file with FZK viewer. Please see the gbXML files attached.

Thank you.
gbXMLs.zip

@theo-armour
Copy link
Member

Hi @EK-CEL

Sorry, it took me a while to figure things out. The issue is caused by the first line of the file

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

The gbXML Viewer saved 'Problematic.xml' file in single byte characters UTF-8 but the incoming file was originally saved in double byte characters - UTF 16.

So after saving delete the first line with the xml tag, things were good to go and the file loaded in both OpenStudio and FZK Viewer ( and gbXML Viewer, of course ).

BTW, this explains the 50% reduction in file size as well. ;-)

Questions:

  1. Are you getting a lot of files in UTF-16?
  2. Do you need files in UTF-16?
  3. Should we delete this - line - if found by defailt?

Any thoughts on international file handling appreciated

Also: can I add this file to the demo files?

@EK-CEL
Copy link
Collaborator Author

EK-CEL commented Aug 2, 2018

Wow, you found the reason! Thank you.

My thoughts about your questions:

  1. All the files I get are in UTF-16 because they are generated by my primary tool - Revit.
  2. If we are thinking about an international user then Yes, we need UTF-16 files. We can take it this way - Revit creates UTF-16 file and we can consider it as industry standard.
  3. I don't think we should delete this line. Probably we should synchronize the file encoding and the XML tag. If the tag points to unknown encoding then delete it.

Yes, you can use the files for project needs.

@theo-armour
Copy link
Member

@EK-CEL

Many of the sample files here are from Revit and are UTF-8

https://github.com/ladybug-tools/spider/tree/master/gbxml-sample-files

So it looks like UTF is a user-selectad Revit setting or derived from the operating system or browser settings.

It turns out that saving to UTF 16 is significantly more complicated than saving to UTF-8. And it would take a lot of test to verify files are OK.

I think the first thing I will try to do is:

if <?xml version="1.0" encoding="utf-16"?> then just delete the encoding attribute

therefore: <?xml version="1.0"?>

As far as I can see the encoding is optional, See:

https://msdn.microsoft.com/en-us/library/ms256048(v=vs.110).aspx


Thank you for your permission to use your file as a sample gbXML file.

@EK-CEL
Copy link
Collaborator Author

EK-CEL commented Aug 13, 2018

@theo-armour
I believe that as far as we are using pre-existing gbXML file we should keep the initial encoding. So the Spider should "know" how to form such encoding and be able to work with wide spectrum of encoding tables like those I found in the Notepad++:
image
I think the Spider should reject gbXML files with unknown encoding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants