You are here

function _filebrowser_encoding_from_fs in Filebrowser 7.3

Same name and namespace in other branches
  1. 8 filebrowser.common.inc \_filebrowser_encoding_from_fs()
  2. 7.4 filebrowser.common.inc \_filebrowser_encoding_from_fs()
  3. 7.2 filebrowser.common.inc \_filebrowser_encoding_from_fs()

Convert a string from FileSystem encoding to UTF-8.

Parameters

$node which provide FileSystem encoding information.:

$source source string:

Return value

re-encoded string

2 calls to _filebrowser_encoding_from_fs()
filebrowser_page_download in ./filebrowser.pages.inc
Callback for filebrowser_download/%node menu.
_filebrowser_load_files in ./filebrowser.common.inc

File

./filebrowser.common.inc, line 201
Misc filebrowser common functions.

Code

function _filebrowser_encoding_from_fs(&$node, $source) {

  // For Drupal 6 filebrowser nodes can have an empty value for encoding
  // So let's cater for that.
  // issue #2660282
  if (!is_string($node->folder_presentation->encoding) || strcasecmp($node->folder_presentation->encoding, 'UTF-8')) {
    return $source;
  }
  else {
    return mb_convert_encoding($source, "UTF-8", $node->folder_presentation->encoding);
  }
}