[Solved] Issue with encoding and shared folders

Discussions related to using VirtualBox on Windows hosts.
Post Reply
Lobe
Posts: 5
Joined: 18. Jul 2009, 09:16
Primary OS: MS Windows XP
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 9.04

[Solved] Issue with encoding and shared folders

Post by Lobe »

Hey,

I currently have virtualbox set up to run a LAMP web server on Ubuntu 9.04 as the guest OS. The webserver root shares a folder (through VB's shared folder feature) with the host (Windows XP) so that all changes are instant and do not require a file transfer. The problem is that in javascript files, revisions are showing up weirdly in browsers. The initial load is fine, however any revisions will either truncate the original by the number of characters removed, or append random text (either other snippets of code elsewhere in the program, HTTP headers, or unrecognised characters) to the bottom of the file. For instance, in the IDE after a change is this:

Image

While in firefox it is this (looks like some jquery code on the end):

Image

Using FTP to transfer the files into the Guest OS works fine, however not shared folders. Also this problem is consistent, as I have tested with different browsers (firefox and chrome) and editors (phped, dreamweaver, notepad). Any suggestions as to how to rid myself of this problem?
vbox4me2
Volunteer
Posts: 5218
Joined: 21. Nov 2008, 20:27
Location: Rotterdam
Contact:

Re: Issue with encoding and shared folders

Post by vbox4me2 »

Try a real share, VBox SF don't behave the same as a real one.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Issue with encoding and shared folders

Post by Sasquatch »

This is a common error when sharing files between Windows and Linux. Check the file character encoding that is used. Linux reads and presents files in UTF-8, but Windows saves the files by default with either ISO-8859-1/Latin-1 or Windows-1252. That difference can cause strange behaviour, especially when using characters like quotes and single quotes (' and "). So set your IDE to save the files with UTF-8 encoding.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Lobe
Posts: 5
Joined: 18. Jul 2009, 09:16
Primary OS: MS Windows XP
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 9.04

Re: Issue with encoding and shared folders

Post by Lobe »

Thanks both of you for the help. I have tried using UTF-8 and various other types of encoding but with no success.
vbox4me2 wrote:Try a real share, VBox SF don't behave the same as a real one.
I'm not sure what you mean by this. Could you link to a guide?

Thanks,
Lobe
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Issue with encoding and shared folders

Post by Sasquatch »

Lobe wrote:Thanks both of you for the help. I have tried using UTF-8 and various other types of encoding but with no success.
vbox4me2 wrote:Try a real share, VBox SF don't behave the same as a real one.
I'm not sure what you mean by this. Could you link to a guide?

Thanks,
Lobe
A guide, like one to set up SAMBA on Linux. It's really easy, you only need the client, share the folder over the network with Windows and mount it in Linux. Easy as pie. Plenty to go around on the net.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Lobe
Posts: 5
Joined: 18. Jul 2009, 09:16
Primary OS: MS Windows XP
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 9.04

Re: Issue with encoding and shared folders

Post by Lobe »

Sasquatch wrote:
Lobe wrote:Thanks both of you for the help. I have tried using UTF-8 and various other types of encoding but with no success.
vbox4me2 wrote:Try a real share, VBox SF don't behave the same as a real one.
I'm not sure what you mean by this. Could you link to a guide?

Thanks,
Lobe
A guide, like one to set up SAMBA on Linux. It's really easy, you only need the client, share the folder over the network with Windows and mount it in Linux. Easy as pie. Plenty to go around on the net.
Thanks, I'll have a look around, try it later today and report back.
Lobe
Posts: 5
Joined: 18. Jul 2009, 09:16
Primary OS: MS Windows XP
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 9.04

Re: Issue with encoding and shared folders

Post by Lobe »

Well, I tried, however getting the network share to be visible in Linux is proving troublesome. I have enabled file sharing on the folder that needs sharing, so that any computer attached to my home network can access the folder by viewing \\HOSTNAME\FOLDER, except the copy of ubuntu in Virtualbox. I am using the instructions here.

When I type smbclient -L HOSTNAME -U USERNAME an error occurs:

Connection to HOSTNAME failed (Error NT_STATUS_BAD_NETWORK_NAME). I assume this means it couldn't find the share. Do I need to change the networking settings or such to access the share in a Guest OS? Sorry if I have done something blatantly noobish.
Lobe
Posts: 5
Joined: 18. Jul 2009, 09:16
Primary OS: MS Windows XP
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 9.04

Re: Issue with encoding and shared folders

Post by Lobe »

Nevermind, problem solved. Turns out I had to use the host IP address rather than the hostname. Using a network share fixed the problem completely from what I have tried so far. Thanks a lot for helping me out, this has got to be the most annoying problem I have had computer-wise in the last few months, glad its solved.
Post Reply