Refresh existing encodings for messages, when encoding was changed by user in dialog

        :return:
430670
def refresh_existing_encodings(self):
        
        update = False

        for msg in self.proto_analyzer.messages:
            i = next((i for i, d in enumerate(self.decodings) if d.name == msg.decoder.name), 0)
            if msg.decoder != self.decodings[i]:
                update = True
                msg.decoder = self.decodings[i]
                msg.clear_decoded_bits()
                msg.clear_encoded_bits()

        if update:
            self.protocol_model.update()
            self.label_value_model.update()
402241
def encodeMsg(self, mesg):
        ''''''

        fmt = self.locs.get('log:fmt')
        if fmt == 'jsonl':
            s = json.dumps(mesg, sort_keys=True) + '\n'
            buf = s.encode()
            return buf

        elif fmt == 'mpk':
            buf = s_msgpack.en(mesg)
            return buf

        mesg = f'Unknown encoding format: {fmt}'
        raise s_exc.SynErr(mesg=mesg)
717694
def _ensure_decoded(s):
    
    if isinstance(s, np.bytes_):
        s = s.decode('UTF-8')
    return s
1158180
private function updateMessage()
    {
        $this->message = $this->rawMessage;

        $dot = false;
        if ('.' === substr($this->message, -1)) {
            $this->message = substr($this->message, 0, -1);
            $dot = true;
        }

        if (null !== $this->document) {
            $this->message .= sprintf(' in %s', $this->document);
        }

        if ($this->snippet) {
            $this->message .= sprintf(' (near %s)', $this->snippet);
        }

        if ($dot) {
            $this->message .= '.';
        }
    }
1194413
private String messageImportUpdate(Locale locale) {

        return Messages.get().getBundle(locale).key(Messages.ERR_ALIAS_IMPORT_UPDATED_0);
    }
1071084
def text_data(encoding=nil)
      if raw_data.respond_to?(:encoding)
        raw_data.force_encoding(encoding || Encoding::UTF_8)
      else
        raw_data
      end
    end
546818
def cancel_encoding(id, factory_id, opts = {})
      data, _status_code, _headers = cancel_encoding_with_http_info(id, factory_id, opts)
      return data
    end
1212530
def set_encoding(self, value=DEFAULT_ENCODING):
        
        if self._conn.encoding != value:
            self._conn.set_client_encoding(value)
221471
public void updateMimeType() 
    {
        _mimeType=null;
        _characterEncoding=null;
            
        String contentType= _header.get(HttpFields.__ContentType);
        if (contentType!=null)
        {
            // Look for encoding in contentType
            int i0=contentType.indexOf(';');
            
            if (i0>0)
            {
                // Strip params off mimetype
                _mimeType=contentType.substring(0,i0).trim();

                // Look for charset
                int i1=contentType.indexOf("charset=",i0);
                if (i1>=0)
                {
                    i1+=8;
                    int i2 = contentType.indexOf(' ',i1);
                    _characterEncoding = (0<i2)
                        ? contentType.substring(i1,i2)
                        : contentType.substring(i1);
                    _characterEncoding = QuotedStringTokenizer.unquote(_characterEncoding);
                }
            }
            else 
            {
                _mimeType=contentType;
            }
        }
    }
335154
def trans(self, id, parameters=None, domain=None, locale=None):
        
        if parameters is None:
            parameters = {}

        if locale is None:
            locale = self.locale
        else:
            self._assert_valid_locale(locale)

        if domain is None:
            domain = 'messages'

        catalogue = self.get_catalogue(locale)
        if not catalogue.has(id, domain):
            raise RuntimeError(
                "There is no translation for {0} in domain {1}".format(
                    id,
                    domain
                )
            )

        msg = self.get_catalogue(locale).get(id, domain)
        return self.format(msg, parameters)
1334200
def get_preferred_encodings(self):
        
        encodings = []
        for row in range(self.ui.tableWidgetPreferred.rowCount()):
            item = self.ui.tableWidgetPreferred.item(row, 0)
            encodings.append(item.data(QtCore.Qt.UserRole))
        return encodings
91313
function _changeEncodingAndReloadDoc(document) {
        var promise = document.reload();
        promise.done(function (text, readTimestamp) {
            encodingSelect.$button.text(document.file._encoding);
            // Store the preferred encoding in the state
            var projectRoot = ProjectManager.getProjectRoot(),
                context = {
                    location : {
                        scope: "user",
                        layer: "project",
                        layerID: projectRoot.fullPath
                    }
                };
            var encoding = PreferencesManager.getViewState("encoding", context);
            encoding[document.file.fullPath] = document.file._encoding;
            PreferencesManager.setViewState("encoding", encoding, context);
        });
        promise.fail(function (error) {
            console.log("Error reloading contents of " + document.file.fullPath, error);
        });
    }
826508
function _setDefaultTranslations(){
                    $scope.mdtTranslations = $scope.mdtTranslations || {};

                    $scope.mdtTranslations.rowsPerPage = $scope.mdtTranslations.rowsPerPage || 'Rows per page:';

                    $scope.mdtTranslations.largeEditDialog = $scope.mdtTranslations.largeEditDialog || {};
                    $scope.mdtTranslations.largeEditDialog.saveButtonLabel = $scope.mdtTranslations.largeEditDialog.saveButtonLabel || 'Save';
                    $scope.mdtTranslations.largeEditDialog.cancelButtonLabel = $scope.mdtTranslations.largeEditDialog.cancelButtonLabel || 'Cancel';
                }
977567
function _treatGlobalMessagesPerType(messages, type) {
    messages.forEach(function convertErrorsIntoNotification(element) {
        let options = {};
        if (isObject(element)) {
            options = _formatParameters(element.parameters);
            element = element.message;
        }
        addMessage({
            type: type,
            content: translate(element, options),
            creationDate: Date.now()
        });
    });
}
981183
def _get_encoding_from_headers(headers):
    
    if headers and "Content-Type" in headers:
        content_type, params = cgi.parse_header(headers["Content-Type"])
        if "charset" in params:
            return params['charset']
    return None
1305242
def force_encoding(data, encoding=Encoding.default_external)
      return data if data.respond_to?(:rewind) # e.g. Tempfile, File, etc
      if data.respond_to?(:force_encoding)
        data.force_encoding(encoding).encode!
      elsif data.respond_to?(:each_value)
        data.each_value{ |v| force_encoding(v, encoding) }
      elsif data.respond_to?(:each)
        data.each{ |v| force_encoding(v, encoding) }
      end
      data
    end
940752
def _AddUnicodeMethod(unused_message_descriptor, cls):
  """"""

  def __unicode__(self):
    return text_format.MessageToString(self, as_utf8=True).decode('utf-8')
  cls.__unicode__ = __unicode__