John Davidson

php - Is FL_ENC_RAW a valid flag for ZipArchive::addFromString?

0 comments
Message:


I have a "string" variable that contains binary jpeg data. I want to add this jpeg to a zip file. According to the documentation the $flags parameter is a



Bitmask consisting of ZipArchive::FL_OVERWRITE, ZipArchive::FL_ENC_GUESS, ZipArchive::FL_ENC_UTF_8, ZipArchive::FL_ENC_CP437.



ZipArchive::FL_ENC_GUESS would probably work, but it sounds like that is going to try to heuristically guess encoding based on the contents of my variable. If I want to be explicit, should I set $flags to ZipArchive::FL_ENC_UTF_8 or ZipArchive::FL_ENC_CP437? Between the 2, ZipArchive::FL_ENC_UTF_8 seems like the better choice.


ZipArchive::FL_ENC_RAW seems like what I should really be using, but according to the docs this is not a valid flag for this particular function. Is this an omission? As best I can tell it's not listed as a valid flag for any function.



My Answer:
checked the official PHP documentation for the ZipArchive::addFromString method and I could not find any mention of a flag called FL_ENC_RAW. It is possible that this flag does not exist or is not supported by the method. It is always recommended to refer to the official documentation for accurate information on PHP functions and methods.

Rate this post

5 of 5 based on 3620 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us