Jump to content


p4java - shelving utf16 files cause filetype to change to binary

p4java utf16 shelving

  • Please log in to reply
6 replies to this topic

#1 eranb

eranb

    Advanced Member

  • Members
  • PipPipPip
  • 55 posts

Posted 07 April 2015 - 08:35 PM

Hi
I have issues shelving utf16 files using P4Java.
The command I use is
client.shelveChangelist(changelist);

After this command, the files in the server somehow change type to Binary (according to our IT guys)

I saw this bug marked as resolved in the release notes:
#655384 (Bug #66260)
Fixed an issue with P4Java's Perforce file type detection
(infer file type by content) mistakenly detected 'utf16'
(unicode) files as binary.

Can you please check if this issue still exist? it's a bit urgent...

The full flow is:
un-shelve changelist to a new changelist --> shelve the files in the new changelist --> revert the files in the new changelist.

Please run this flow with several utf16 files. it's reproduced only in some of the cases.
The utf16 files are valid. with P4V it runs smoothly.

Thanks,
Eran

#2 eranb

eranb

    Advanced Member

  • Members
  • PipPipPip
  • 55 posts

Posted 07 April 2015 - 08:36 PM

BTW, I'm using latest version of P4Java (2014.1)

Thanks

#3 P4Jen

P4Jen

    Advanced Member

  • Staff Moderators
  • 151 posts

Posted 08 April 2015 - 02:05 PM

Hi Eran,

I am not aware of such a regression, so we will need to try and reproduce this in house.

The fact that the files could be shelved through P4V without problems, does suggest that this is a P4Java issue.

I would like to see the portions of the server logs that correspond to the time when this issue occurred, and also get a sample of the UTF16 files that have had their type changed to binary.

Because this data is potentially sensitive, please send it to:

  support@perforce.com

along with the output from:

  p4 -ztag info

It would also be helpful if you could send us your Java project.

Cheers,
Jen.


#4 eranb

eranb

    Advanced Member

  • Members
  • PipPipPip
  • 55 posts

Posted 12 April 2015 - 12:44 PM

I'm checking.
Will let you know soon.

Thanks

#5 eranb

eranb

    Advanced Member

  • Members
  • PipPipPip
  • 55 posts

Posted 14 April 2015 - 11:26 AM

I did some checks and it turns out I got wrong information (Please change the post title if it's possible).
Files of type utf16 unshelved using P4V are encoded using utf16 little endian, while those using P4Java are encoded using utf16 big endian.

Am I missing some kind of initialization?
let me know if you need more information.

Thanks,
Eran

#6 eranb

eranb

    Advanced Member

  • Members
  • PipPipPip
  • 55 posts

Posted 14 April 2015 - 11:34 AM

This is my issue I assume:
http://forums.perfor...dian#entry16328

#7 P4Shimada

P4Shimada

    Advanced Member

  • Members
  • PipPipPip
  • 831 posts

Posted 14 April 2015 - 11:53 PM

Hi Eran,

Yes, there is an existing enhancement regarding the P4Java UTF16 little endian vs big endian issue.

This seems to be the default JVM behavior if the "utf16" file has no BOM. When decoding, the Java "UTF-16" charset defaults to big-endian if there is no byte-order mark.

The fix for this is to use the client's charset (P4CHARSET) for conversion when Perforce file type is "utf16".

The client charset can be set using the IServer.setCharsetName(String charsetName). The 'p4 help charset' command gives a list of supported Perforce charset names.

For example, if client charset "utf16le" is set, P4Java would use the Java "UTF-16LE" for conversion.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users