Copy link to clipboard
Copied
Hi,
We have a PHP and MYSQL system which generates a JSX file for design.
It pulls one value out of the database and via php to the jsx file.
We have an issue with some characters which are set in the UTF8 charset, which are correctly displayed in the database and in PHP and HTML.
But when set in photoshop code, it causes issues and displays them incorrectly.
For example
activeDocument.activeLayer.textItem.contents="""' . $rs_item['slogan_name'] . '""";
Du ser mig kun for det tøj jeg har på
This displays correctly in php, mysql etc, but when set in photoshop it displays to:
Du ser mig kun for det tøj jeg har på
Is there a way to set a charset for a value for photoshop?
I tried
activeDocument.activeLayer.textItem.encoding = "UTF8";
but i dont think there is such a value for textitem?
Thanks
You here gave an example of your PHP script.
...if($_SESSION['admin_name']!=="Admin") {
// CLOSE THE TEMPLATE PSD AND OPEN THE ACTUAL DESIGN IN PSD
$design_code .= '
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
var fileRef = "' . "/z/DESIGN_SERVER/" . $savefilename . ".psd" . '";
app.open( new File( fileRef ) );
';
} else {
// CLOSE THE TEMPLATE PSD AND OPEN THE ACTUAL DESIGN PDF
$design_code .= '
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
var fileRef =
Copy link to clipboard
Copied
You here gave an example of your PHP script.
if($_SESSION['admin_name']!=="Admin") {
// CLOSE THE TEMPLATE PSD AND OPEN THE ACTUAL DESIGN IN PSD
$design_code .= '
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
var fileRef = "' . "/z/DESIGN_SERVER/" . $savefilename . ".psd" . '";
app.open( new File( fileRef ) );
';
} else {
// CLOSE THE TEMPLATE PSD AND OPEN THE ACTUAL DESIGN PDF
$design_code .= '
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
var fileRef = "' . "/z/DESIGN_SERVER/" . $savefilename . ".pdf" . '";
app.open( new File( fileRef ) );
';
}
So that's it.
Although I do not know PHP, I can advise you to change the code like this so that the first characters in the $ design_code variable are always UTF8 BOM (three invisible byte characters).
// set UTF8 BOM at the brgining of the $design_code variable
$design_code = chr(239) . chr(187) . chr(191);
if($_SESSION['admin_name']!=="Admin") {
// CLOSE THE TEMPLATE PSD AND OPEN THE ACTUAL DESIGN IN PSD
$design_code .= '
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
var fileRef = "' . "/z/DESIGN_SERVER/" . $savefilename . ".psd" . '";
app.open( new File( fileRef ) );
';
} else {
// CLOSE THE TEMPLATE PSD AND OPEN THE ACTUAL DESIGN PDF
$design_code .= '
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
var fileRef = "' . "/z/DESIGN_SERVER/" . $savefilename . ".pdf" . '";
app.open( new File( fileRef ) );
';
}
P.S. Good luck ![]()
Copy link to clipboard
Copied
$design_code = chr(239) . chr(187) . chr(191);
this fixed it. Thank you.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now