Jump to content

Retrieve file encoding using P4API.NET

File Encoding P4API.NET

  • Please log in to reply
2 replies to this topic

#1 Sarath Kumar Harikrishnan

Sarath Kumar Harikrishnan


  • Members
  • Pip
  • 2 posts

Posted 17 June 2019 - 10:05 AM

Hi Team,

I'm trying to retrieve encoding of file (like UTF-8, UTF-8 BOM, UCS-2 LE etc) in perforce repository.

Tried using FileHistory class, but that gives only Perforce filetype.

My requirement is, without syncing the file from the repository, i should be able to retrieve file encoding information.

Please guide me on if i can get that information using P4API also i would welcome other possible options which i can try and get the encoding information.


#2 p4rfong


    Advanced Member

  • Staff Moderators
  • 343 posts

Posted 26 June 2019 - 07:50 PM

Please post your question under the APIs topic.

#3 Sambwise


    Advanced Member

  • Members
  • PipPipPip
  • 1121 posts

Posted 26 June 2019 - 09:26 PM

The server returns the charset from the "p4 fstat" command as "headCharset":


This corresponds to the "FileMetadata" object in P4API.NET:


but there's no HeadCharset property in there, so there probably needs to be a change to P4API.NET to pipe it through.

Also tagged with one or more of these keywords: File Encoding, P4API.NET

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users